Back to formatter

Learn JSON

History, types, and how JSON is structured

JSON is the lingua franca of APIs and configs. This short guide covers where it came from, the six value types, and the rules that trip people up when formatting or validating payloads.

A short history

  1. 2001

    Douglas Crockford names JSON

    JSON (JavaScript Object Notation) was popularized as a lightweight data format based on a subset of JavaScript object literal syntax — simple enough to parse everywhere.

  2. 2002–2006

    Web APIs adopt it

    As Ajax apps grew, JSON replaced much of XML for API payloads: smaller on the wire, easier for browsers and scripting languages to consume.

  3. 2013

    ECMA-404 & RFC 7159

    JSON was standardized so parsers agree on edge cases (numbers, Unicode, duplicate keys). Today almost every language ships a JSON library.

  4. Today

    The default interchange format

    Configs, webhooks, logs, mobile apps, and LLM tool calls all lean on JSON. Formatting and validating it quickly is a daily developer habit.

The six JSON types

Every JSON value is exactly one of these. Objects and arrays compose the other four into trees.

  • string

    "hello"

    Text in double quotes. Escapes like \n, \t, \\ and \" are allowed; single quotes are not.

  • number

    42 / 3.14

    Integers or floats. No leading zeros (except 0), and NaN / Infinity are not valid JSON.

  • boolean

    true / false

    Only the lowercase literals true and false. Strings like "true" are not booleans.

  • null

    null

    A deliberate empty value. Different from missing keys, empty strings, or undefined (which JSON does not have).

  • object

    { "a": 1 }

    Unordered sets of key/value pairs. Keys must be strings. Nested objects and arrays are allowed.

  • array

    [1, "x", false]

    Ordered lists of values. Items can mix types. Trailing commas are invalid.

Structure in practice

Objects nest keys; arrays nest ordered items. Depth is unlimited in theory, but deep trees are harder to read — that is why formatters indent by level and tools like tree or fold views help you navigate.

{
  "id": "ord_42",
  "paid": true,
  "total": 66.5,
  "customer": null,
  "items": [
    { "sku": "TEE-M", "qty": 2 }
  ]
}

Strings, boolean, number, null, object, and array — all six types in one document.

Rules that break parsers

  • Property names and strings use double quotes only.
  • No trailing commas in objects or arrays.
  • No comments (// or /* */) in standard JSON.
  • No undefined, functions, or dates as native types — encode dates as strings (often ISO-8601).
  • Numbers cannot be NaN or Infinity.
  • A document is a single value: usually an object or array at the root.

Try it in the formatter

Paste a payload on the home page to beautify, minify, validate, escape, unescape, diff, or check a schema — all in your browser.

Open JSON Formatter