Web apps & software

What is JSON?

JSON (JavaScript Object Notation) is a plain-text format for storing and exchanging structured data as key-value pairs and lists. It is the default format of most web APIs, configuration files and webhook payloads because people and programs can both read it easily.

What it looks like

A booking might be sent as {"id": 1042, "pickup": "Main St", "passengers": 2, "paid": false, "stops": ["Airport"]}. Curly braces hold objects, square brackets hold arrays, and keys are always in double quotes.

The data types

JSON has only six: string, number, boolean (true or false), null, object and array. There is no date type, so dates travel as strings, ideally in ISO 8601 format with a timezone, such as 2026-11-08T14:30:00Z. There is no separate integer type either, which is why money is often sent as whole cents or as a string to avoid rounding errors.

Errors people make

  • Trailing commas and single quotes, which strict JSON forbids.
  • Comments, which JSON does not support (JSON5 and YAML do).
  • Large IDs losing precision when JavaScript parses numbers beyond its safe integer range.
  • Assuming fields are present; robust code checks for missing or null values.

JSON versus alternatives

XML is more verbose but supports schemas and attributes; YAML is friendlier for hand-written config; Protocol Buffers are smaller and faster for service-to-service traffic. For public APIs, JSON remains the safe default.

Questions, answered

No. Virtually every programming language can read and write it.

Paste it into a JSON formatter or validator, which points to the line with the error.

By the Stegnor team · Updated