SUMMARY
JSON is a lightweight data format designed to easily represent complex data structures. The format uses a subset of JavaScript syntax to represent objects, arrays, strings, numbers, Booleans, and null
. Even though XML can handle the same job, JSON is less verbose and has better support in JavaScript. What's more, the native JSON
object is well supported across all browsers.
ECMAScript 5 defines a native JSON
object that is used for serialization of objects into JSON format and for parsing JSON data into JavaScript objects. The JSON.stringify()
and JSON.parse()
methods are used for these two operations, respectively. Both methods have a number of options that allow you to change the default behavior to filter or otherwise modify the process.