简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM