I know to use eval()
to parse JSON to an object, but how do I parse an object to JSON format using JavaScript?
Thanks.
I know to use eval()
to parse JSON to an object, but how do I parse an object to JSON format using JavaScript?
Thanks.
Usually if you have a json and want to access something underneath it you just put a dot, like if the name of your json is msg and you want the location parameter it would be:
msg.location
The newer browsers support JSON.stringify
. You can also download and include it yourself.
var json = JSON.stringify(yourObject);
Afaik jQuery does not provide such a method.