3

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

1
  • 1
    you can use parseJSON if you are using jquery Commented May 19, 2013 at 18:28

1 Answer 1

22

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

Sign up to request clarification or add additional context in comments.

5 Comments

Beware of browser compatibility issues, as noted on this link: developer.mozilla.org/en-US/docs/JavaScript/Reference/….
dude it's talking about ff 3.5, that's like history :) all browsers today support JSON...
Yep, I know, but IE8- still haunts the web...
it's supported in IE8..caniuse.com/json
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.