How to parse JSON (key ,value) String on the UI side in javascript

By : Divya
Source: Stackoverflow.com
Question!

I am using ReactJs on UI side and after making an ajax call to backend service the response I get is a JSON string like the one below,can anyone tell me how to parse it into key value pair again in UI code.

{name=xyz, transit_To=INIT, request=something, Skip=true, action=Submit , Priority=1, Node=Submit}

How can i access the key value pairs as this is a string.

Any sort of information would be really helpful.

By : Divya


Answers

That's not valid JSON syntax, so assuming you're getting valid JSON back:

$ const parsed_json = JSON.parse('{"name":"xyz","transit_To":"INIT"}');
// Object {name: "xyz", transit_To: "INIT"}

$ parsed_json.name
// "xyz"
By : Mishap


"When you get a JSON string in response, do not look at it."



This video can help you solving your question :)
By: admin