Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This question already has an answer here:

Is it possible convert string from JSON.stringify back to Array?

share|improve this question
2  
JSON.parse() maybe? – Sam May 19 at 18:27
1  
you can use parseJSON if you are using jquery – karthikr May 19 at 18:28

marked as duplicate by Asad, rcdmk, m90, Book Of Zeus, likeitlikeit May 19 at 23:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

JSON.parse is your friend and answer :)

//examples:
JSON.parse('{}'); // {}
JSON.parse('true'); // true
JSON.parse('"foo"'); // "foo"
JSON.parse('[1, 5, "false"]'); // [1, 5, "false"]
JSON.parse('null'); // null

MDN JSON.Parse details

share|improve this answer
Beware of browser compatibility issues, as noted on this link: developer.mozilla.org/en-US/docs/JavaScript/Reference/…. – rcdmk May 19 at 18:34
dude it's talking about ff 3.5, that's like history :) all browsers today support JSON... – Dory Zidon May 19 at 18:43
Yep, I know, but IE8- still haunts the web... – rcdmk May 19 at 18:45
it's supported in IE8..caniuse.com/json – Dory Zidon May 19 at 18:49
Well... It all dependes on the target audience, but I think it's always better to use a polyfill like json2 in case the browser does not support the native APIs. – rcdmk May 19 at 18:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.