JSON object converted to JSON string
You can use toJSONString () or global method Json.stringify () to convert a JSON object to a JSON string.
1. toJSONString () method
var last=obj.tojsonstring (); Convert a JSON object to a JSON character
2. Json.stringify () method
var last=json.stringify (obj); Convert a JSON object to a JSON character
alert (last);
in the above several methods, in addition to the eval () function is JS own, the other several methods are from the Json.js package. The new version of JSON modifies the API to inject json.stringify () and Json.parse () two methods into the Javascript built-in object, which becomes the object.tojsonstring (), and the latter becomes the Strin G.parsejson (). If you are prompted not to find the tojsonstring () and Parsejson () methods, your JSON package version is too low.
JSON object converted to JSON string