Convert Array to Json

Possible Duplicate:
Serializing to JSON in jQuery
Convert Object to JSON string

I want to convert array to json object in js or jquery. Is there any function is available or lib

Thanks in advance


In modern browsers you can simply use JSON.stringify(someJSObject) to convert any JavaScript object (that includes arrays) to a JSON string.

To ensure it also works in less modern browsers, include https://github.com/douglascrockford/JSON-js/blob/master/json2.js on your page.


怎么样

var jsonString = JSON.stringify(myArray);
链接地址: http://www.djcxy.com/p/8082.html

上一篇: 如何使用jquery / javascript将文本插入到json中

下一篇: 将数组转换为Json