kheya
kheya

Reputation: 7612

How to convert string to JSON object?

I am using jquery 1.3.2 and I can't use the parseJSON since it is added in 1.4.1 & I can't upgrade right now.

Is there any wat to get JSON object from string?

If this is a duplicate please send me the link.

Thanks for reading

Upvotes: 0

Views: 3031

Answers (2)

zack
zack

Reputation: 3198

json2.js : http://www.json.org/js.html

Upvotes: 1

Codemwnci
Codemwnci

Reputation: 54884

You can use a couple of options, see here

  • Javascript eval function
  • JSON.parse() function

The eval function has some security issues associated with it, and the JSON.parse function has its own set of incompatibilities. I guess this is why JQuery has its own wrapper function. If you can't use JQuery 1.4+ though, these are two of your best options, without going looking for a specific JSON parsing library.

Upvotes: 2

Related Questions