JavaScript Object Notation
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999.
History & Origin
JSON was popularized by Douglas Crockford in the early 2000s as a stateless, real-time server-to-browser communication protocol. It replaced XML as the de-facto standard for AJAX requests due to its simplicity and native compatibility with JavaScript.
Internal Structure
JSON is built on two structures: a collection of name/value pairs (object) and an ordered list of values (array). Values can be strings, numbers, booleans, null, objects, or arrays. It follows strict syntax rules (e.g., keys must be double-quoted strings).
Advantages
- Human-readable: Easy to understand and debug.
- Lightweight: Less verbose than XML.
- Native parsing: Built-in support in almost all programming languages.
- Hierarchical: Can represent complex data structures.
Disadvantages
- No comments: Standard JSON does not support comments.
- Strict syntax: A missing comma or quote renders the file invalid.
- No schema enforcement: Unlike XML, it doesn't enforce a schema by default (though JSON Schema exists).
