I'm stringyfing an object like:
"{'foo': 'bar','task':[{'task1':'task1'}]}"
How can I turn the string back to an object?
I'm stringyfing an object like:
"{'foo': 'bar','task':[{'task1':'task1'}]}"
How can I turn the string back to an object?
Try the following solution to parse the stringified JSONObject.
// Stringified JSON Object
var stringifiedJSONObject = '{'foo': 'bar','task':[{'task1':'task1'}]}';
// Parsing string object to json
var jsonObject = JSON.parse(stringifiedJSONObject);
// Get the inner array. The below object is a JSON Array of Objects
var innerArray = jsonObject.task;
// displays the value of task1
alert(innerArray[0].task1);