angular – Angular2 cast string to JSON

angular – Angular2 cast string to JSON

Angular2 uses JavaScript functions unlike Angular1.

Angular1 implements its own functions which is a bad thing.

In Angular2 just use pure JavaScript.

var json = JSON.parse(string);

Try using JSON.parse()

var someString: string = your JSON String here;
var jsonObject : any = JSON.parse(someString)

angular – Angular2 cast string to JSON

Leave a Reply

Your email address will not be published. Required fields are marked *