JSON

JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. It represents data as a small set of structures (objects, arrays, strings, numbers, booleans, null) that map naturally to native types in most programming languages, which is why it has become the default payload format for web APIs.

Structure

  • Object: { "key": value } with string keys
  • Array: [ value, value, ... ]
  • String: double-quoted, with backslash escapes
  • Number: integer or floating-point, no NaN or Infinity
  • Boolean: true or false
  • Null: null
  • JSONC. JSON with comments, used in some config files.
  • JSON5. Relaxed JSON allowing trailing commas, single quotes, and unquoted keys.
  • JSON Lines (NDJSON): one JSON object per line, used for streaming and logs.
  • BSON: binary JSON with extended types, used by MongoDB.
  • JSON Schema: a schema language for validating JSON documents.

Specification

Standardized as RFC 8259 and ECMA-404.

🔗
Related Terms
REST API, HTTP, GraphQL, OpenAPI, JWT.

Subscribe to Sahil's Playbook

Clear thinking on product, engineering, and building at scale. No noise. One email when there's something worth sharing.
[email protected]
Subscribe
Mastodon