Convert Array to Json
103,431
Solution 1
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.
Solution 2
How about
var jsonString = JSON.stringify(myArray);
Author by
sachin
-(id) init{ self = [ios init] + [flex init] + [cakephp init]; return self; }
Updated on July 09, 2022Comments
-
sachin almost 2 years
Possible Duplicate:
Serializing to JSON in jQuery
Convert Object to JSON stringI want to convert array to json object in js or jquery. Is there any function is available or lib
Thanks in advance