2

i have some arrays and js objects put into a string using JSON.stringify

how can i decode that string again into arrays and objects ?

Thank you .

Rami Dabain
  • 4,581
  • 12
  • 59
  • 104

3 Answers3

7

JSON.parse lets you do that.

You can see plenty of examples everywhere on the Intarwebs.

Even jQuery has a shim for this method (not supported in IE6, maybe 7): jQuery.parseJSON. That is, if you use jQuery.

Florian Margaine
  • 54,552
  • 14
  • 89
  • 116
2

That would be:

JSON.parse

cheers Dom

Dominik Kukacka
  • 559
  • 1
  • 5
  • 15
0

You could use the eval method, or, much better, use JSON.parse. Please check this link for more info: http://www.json.org/js.html

Erik Pragt
  • 12,458
  • 10
  • 52
  • 58