What is JSON?
JSON (.json) files contain structured data in key-value pairs using JavaScript syntax. JSON supports strings, numbers, booleans, arrays, objects, and null values. Its simplicity and universal parsing support make it ideal for APIs, configuration files, and data storage.
JSON has replaced XML in most modern web APIs due to its lightweight syntax and native JavaScript compatibility. It's language-independent and supported by virtually every programming language.
History
JSON was specified by Douglas Crockford in 2001 as a lightweight alternative to XML. It quickly gained adoption due to its simplicity and compatibility with JavaScript.
Key Milestones
- 2001: JSON first specified
- 2006: RFC 4627 standardization
- 2013: ECMA-404 standard
- 2017: RFC 8259 (current standard)
- Present: Universal web API format
Key Features
Core Capabilities
- Simplicity: Minimal syntax
- Human-Readable: Easy to read and edit
- Data Types: Strings, numbers, booleans, arrays, objects
- Nested Structures: Objects within objects
- Language-Independent: Works with all languages
- UTF-8 Encoding: Unicode support
Common Use Cases
REST APIs
Data exchange between systems
Configuration
Settings for applications
Data Storage
NoSQL databases like MongoDB
Log Files
Structured logging
Advantages
- Lightweight and compact
- Easy to read and write
- Native JavaScript parsing
- Universal language support
- Fast parsing performance
- Widely adopted standard
Disadvantages
- No comments allowed
- No date type (strings only)
- Limited data types
- No schema validation (by default)
- Larger than binary formats
Technical Information
Format Specifications
| Specification | Details |
|---|---|
| File Extension | .json |
| MIME Type | application/json |
| Format Type | Data Interchange |
| Encoding | UTF-8 |
| Standard | RFC 8259, ECMA-404 |
| Structure | Key-value pairs |
Common Tools
- Validators: JSONLint, JSON Schema
- Parsers: Built into all languages
- Formatters: Prettier, jq