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,709
  • 12
  • 62
  • 106

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
  • 58,730
  • 15
  • 91
  • 116
2

That would be:

JSON.parse

cheers Dom

Dominik Kukacka
  • 569
  • 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
  • 13,513
  • 11
  • 58
  • 64