What is the correct syntax for translating a string in JSON in Angular2? I tried:
var someString; someString.toJSON();
he says: someString.toJSON is not a function
I got lost because I worked with Angular1.
If I try to add an attribute directly to my string (which is formatted as true JSON):
var someString; someString.att = 'test';
he says: TypeError: Cannot create property 'att' on string '...'
source share