Glossary

JSON

JSON (JavaScript Object Notation) is a lightweight, text-based format for representing structured data as key-value pairs, arrays, strings, numbers, booleans, and null. It grew out of JavaScript's object literal syntax but is language-independent — every mainstream language has a JSON parser, and the format is standardized in RFC 8259 and ECMA-404.

How it works

A JSON document is built from six value types nested inside two container types:

  • Objects — { "key": value, ... }, unordered sets of string-keyed pairs
  • Arrays — [value, value, ...], ordered lists
  • Scalars — strings (double-quoted only, no single quotes), numbers (no leading zeros, no NaN/Infinity), true, false, and null

There is no comment syntax, no trailing commas, and no way to represent dates, binary data, or undefined natively — a frequent source of friction when porting JavaScript objects to JSON. Whitespace between tokens is insignificant, which is why a minifier can strip it to shrink payload size without changing meaning, while a "pretty-print" step reintroduces indentation for readability.

Example:

{
  "id": 42,
  "name": "Ada Lovelace",
  "tags": ["math", "computing"],
  "active": true,
  "manager": null
}

Common pitfalls

  • Trailing commas and single-quoted strings are valid in JavaScript object literals but invalid JSON — a strict parser will reject them.
  • Large integers (beyond Number.MAX_SAFE_INTEGER, 2^53−1) silently lose precision when parsed into a JavaScript number.
  • Duplicate keys in an object are technically undefined behavior — most parsers keep the last one, but don't rely on it.
  • Non-ASCII text must be valid UTF-8 (or escaped as \uXXXX); a mismatched encoding produces mojibake, not a parse error.

Related terms

  • XML — the older, tag-based alternative JSON largely replaced for web APIs.
  • CSV — a flatter tabular format; converting between the two means deciding how to represent nested objects and arrays as rows.
  • YAML — a superset-ish, indentation-based format often used for config files where JSON's quoting and bracket noise is unwelcome.
  • TOML — another config-oriented alternative that trades JSON's nesting flexibility for stricter, more explicit typing.
  • Unicode — the character set JSON strings are encoded in.

See also

  • Tool: JSON Formatter & Validator — validate, beautify, or minify JSON directly in the browser, with error locations for malformed input.