Skip to main content
Basics

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

1

REST API response: A product API returns {"id": 42, "name": "Software", "price": 9999, "inStock": true}.

2

package.json: Node projects define dependencies, scripts and metadata in JSON.

3

Config: tsconfig.json, .eslintrc.json, .prettierrc – the JS ecosystem uses JSON for config.

4

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?

JSON has largely replaced XML for data exchange. JSON is smaller (often 30–50%), easier to parse and better suited to web APIs. XML still has advantages for mixed content, namespaces/schemas (XSD) and legacy systems (SOAP, XSLT). For new APIs and web apps, JSON is the default choice.

What is JSON Schema?

JSON Schema is a vocabulary for describing and validating JSON. It defines expected types, required fields, ranges, string patterns and nested structures. Used for API validation, form generation and documentation. Tools like AJV (JavaScript) validate JSON against a schema very quickly.

How do I handle large JSON files?

For large files (hundreds of MB+): use streaming parsers that process incrementally (e.g. JSONStream, jq). JSON Lines (JSONL): one JSON object per line, good for logs and big data. Compression (gzip) greatly reduces size. Pagination in APIs avoids huge single responses.

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.

Next Step

Questions about the topic? We're happy to help.

Our experts are available for in-depth conversations – no strings attached.

30 min strategy call – 100% free & non-binding

What is JSON? The Data Exchange Format Explained