JSON
JavaScript Object Notation – a lightweight format for structured data. The de facto standard for REST APIs and config files.
JSON is the universal data format of the modern web. Almost every API, config file and system-to-system exchange uses JSON. What began as JavaScript notation is now language-agnostic and supported everywhere. JSON has largely replaced XML as the dominant exchange format thanks to simplicity, readability and smaller size.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based format for representing structured data. It has two structures: objects (key–value pairs in braces: {"name": "Max", "age": 30}) and arrays (ordered lists in brackets: [1, 2, 3]). Types: string, number, boolean, null, object, array. JSON is language- and platform-independent; parsers exist for all major languages. MIME type is application/json.
How does JSON work?
JSON is sent as text and parsed by the receiver: in JavaScript, JSON.parse() (string to object) and JSON.stringify() (object to string). APIs return JSON in the response body; clients deserialize into local structures. JSON Schema allows validation of structure, types and constraints. Streaming parsers handle large JSON without loading everything into memory. JSON5 and JSONC add comments and trailing commas for config.
Practical Examples
REST API response: A product API returns {"id": 42, "name": "Software", "price": 9999, "inStock": true}.
package.json: Node projects define dependencies, scripts and metadata in JSON.
Config: tsconfig.json, .eslintrc.json, .prettierrc – the JS ecosystem uses JSON for config.
Database: MongoDB stores documents as BSON (binary JSON) with extra types (date, binary).
Typical Use Cases
API communication: Standard format for REST and GraphQL APIs
Configuration: Settings and metadata for apps and tools
Storage: NoSQL databases (MongoDB, CouchDB) use JSON-like documents
Logging: Structured logs in JSON for parsing and analysis
Data exchange: Import/export between systems
Advantages and Disadvantages
Advantages
- Simple: Easy to read, write and debug
- Compact: Less overhead than XML
- Universal: Supported in all languages and platforms
- Native in JS: JSON.parse() and JSON.stringify() are built in
- Typed: Distinguishes string, number, boolean, null, array, object
Disadvantages
- No comments: Standard JSON has no comments (JSONC/JSON5 as workarounds)
- No references: No circular references
- No date type: Dates are strings and must be parsed
- No schema: Without JSON Schema, structure isn’t enforced
- No streaming: Standard JSON is parsed as a whole before use
Frequently Asked Questions about JSON
JSON or XML?
What is JSON Schema?
How do I handle large JSON files?
Related Terms
Want to use JSON in your project?
We are happy to advise you on JSON and find the optimal solution for your requirements. Benefit from our experience across over 200 projects.