开发者

How do you convert a JSON object to a Javascript array?

I have a JSON string that I would like to convert to a javascript array. How can I do this?

I was under the im开发者_运维百科pression thot JQuery could do this


json2.js is the usual choice for this. It has decent error checking and will use native browser decoding if available.


in general you can do JSON.parse(jsonString). Most browsers support this.

with jquery, if you tell $.ajax() that the response type is json, it will do this for you. See the 'dataType' option here http://api.jquery.com/jQuery.ajax/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜