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.
How about
var jsonString = JSON.stringify(myArray);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With