JSON - JavaScript Object Notation. JSON is a combination of the array and the object literal notation.
{"name": "value", "some": [1, 2, 3]}
Parse JSON:
var json_str = '{"custom_key": "custom value"}'; // an input JSON string var json_data = JSON.parse( json_str ); // default JavaScript method console.log( json_data.custom_key ); // return "custom value"
Serialize any object or array into a JSON string:
var dog_obj = { name: "Fido", dob: new Date(), legs: [1, 2, 3, 4] }; var json_str = JSON.stringify( dog_obj ); // json_str is now: {"name":"Fido","dob":"2010-04-11T22:36:22.436Z","legs":[1,2,3,4]}