JavaScript Object Notation (MIME: application/json) is a lightweight, human-readable data interchange format that has become the de facto standard for web APIs, configuration files, and data exchange between applications. It uses key-value pairs and arrays to represent structured data.
History and Development
JSON (JavaScript Object Notation) was specified by Douglas Crockford in the early 2000s and standardized as ECMA-404 in 2013 and RFC 7159/8259. Originally derived from JavaScript object literal syntax, JSON is now language-independent and supported by virtually every programming language. It largely replaced XML as the preferred format for web APIs.
Technical Specifications
- Format: Plain text, human-readable
- Data types: String, number, boolean, null, array, object
- Encoding: UTF-8 (required by specification)
- Nesting: Unlimited depth for objects and arrays
- Schema: Optional (JSON Schema for validation)
- Comments: Not supported in standard JSON (use JSONC or JSON5)
- Max size: No formal limit
Common Use Cases
JSON is the standard format for REST APIs, web application data exchange, configuration files (package.json, tsconfig.json), NoSQL databases (MongoDB, CouchDB), real-time data streaming, and mobile app data storage. It's also used for data export from analytics platforms.
JSON vs Similar Formats
- JSON vs CSV: JSON supports nested/hierarchical data; CSV is flat tabular data. JSON is preferred for APIs; CSV for spreadsheets.
- JSON vs XML: JSON is more compact and easier to parse; XML supports attributes, namespaces, and schemas. JSON dominates modern web APIs.
- JSON vs YAML: YAML is more human-readable with less syntax; JSON is stricter and more widely supported by APIs.
How to Open and Edit
Any text editor can open JSON files. Browser developer tools display JSON beautifully. For viewing, use JSON viewers like jsoneditoronline.org. Programming languages have built-in JSON parsers (JavaScript JSON.parse, Python json module).
Frequently Asked Questions
What is the difference between JSON and JavaScript objects?
JSON is a text format inspired by JavaScript objects but with stricter rules: keys must be double-quoted strings, no trailing commas, no comments, no functions. JSON is language-independent; JavaScript objects are specific to JavaScript.
Can JSON store dates?
JSON has no native date type. Dates are typically stored as ISO 8601 strings (e.g., "2024-01-15T10:30:00Z") or Unix timestamps. The receiving application must parse them.
Is JSON secure?
JSON itself is just a data format and is safe. However, never use eval() to parse JSON — always use JSON.parse() which safely handles the data without executing code.