PROVIDER Β· the universal data interchange format of the web
JSON
JSON's minimal grammar made it the de facto web interchange format carried by REST APIs, microservice calls, and log events, with JSON Schema and jq completing validation and processing.
Pros
Cons
Product Information
Detailed Notes
Overview
JSON, proposed by Douglas Crockford in 2001 with RFC 4627 in 2006 and RFC 8259 in 2017, expresses data through key-value pairs, arrays, and a few primitives with a minimal grammar natively parsed in nearly every language.
For Programming Languages & Frameworks work the value is an unambiguous universal carrier, since REST API requests and responses standardise on JSON, frontend-backend and cross-language service exchange prefers it, logs, configuration, and event streams adopt it widely, and jq processes it on the command line.
Note the limits, because comments are unsupported requiring JSON5, JSONC, or YAML for configuration, dates and large integers are unsupported so 64-bit IDs lose precision in JavaScript, repetitive keys add size, and huge documents consume memory with streaming needing NDJSON or dedicated libraries.
Core Strengths
- A minimal unambiguous grammar parsed natively in nearly every language
- The REST API de facto standard with the most mature tooling
- Tools like jq enable structured data processing on the command line
- JSON Schema standardises validation and documentation
Product Ecosystem
Data types
Objects, arrays, strings, numbers, booleans, and null with strict UTF-8 encoding.
Interfaces and validation
Carries REST and GraphQL payloads with JSON Schema for contract validation and code generation.
Tools
jq for command line queries, per-language serialisers, and JSONL or NDJSON streaming.
Drawbacks
- No comments requiring JSONC or YAML for configuration
- No native integers beyond double precision or date types
- Repetitive keys add size with large documents costing bandwidth and memory
- Without schema constraints typos surface only at runtime
Use Cases
- REST API interchange (β β β β β ) - The standard
- Frontend and microservice communication (β β β β β ) - Cross-language
- Log and event data (β β β β ) - NDJSON streaming
- Hand-edited configuration (β β ) - YAML or TOML is better
Pricing
| Plan | Price | Scope |
|---|---|---|
| JSON specification and parsers | $0 | Open specification, free |
| jq and validation tools | $0 | Open source and free |
| Hosted API platforms | Platform billing | Built into cloud services |
Entirely free with cost only in transfer volume and parsing, optimised by trimming redundant keys, moving to compact formats like MessagePack where needed, and enabling gzip or brotli compression.
FAQ
-
Can JSON have comments? Standard JSON cannot, so configuration uses JSONC or JSON5 while service exchange should stay standard.
-
Why do large integer IDs break? JavaScript numbers are doubles losing precision beyond 2^53, so backends serialise large IDs as strings.
-
JSON or MessagePack? JSON for readability and ubiquity, MessagePack or Protobuf for size and speed in high-frequency internal RPC.
Code Examples
Typical API response shape
{
"plans": [
{ "id": 1, "name": "Hong Kong VPS", "price": 99, "tags": ["cn2", "ssd"] }
],
"total": 1
}
Objects use braces, arrays use brackets, keys take double quotes, and comments or trailing commas are invalid.
Process it with jq
# plan names under 80 CNY
jq -r '.plans[] | select(.price < 80) | .name' plans.json
# validate syntax and minify output
jq -c . plans.json
Treating JSON as data beats regex surgery with sed or awk.
Community & Resources
Communities and official channels
- JSON Site β Grammar and language implementations
- RFC 8259 β The IETF standard text
- Stack Overflow #json β Parsing and formatting answers
Learning resources and tools
- JSON Schema β Define validation rules for JSON
- jq Manual β Authoritative CLI processing docs
- JSONLint β Online validation