Visual RFC.
ALL RFCs / RFC 8259
Read the RFC ↗
RFC 8259 / JSON BUILDING BLOCKS

How can another app read our shopping list?

01

Group familiar values, write their relationships as text, and let a reader rebuild the information.

RFC 8259 · § 2EXAMPLE
1 / 4 · We want to send information

The picture groups values. A container can hold more values; a word, number, true, false or null can also stand alone.

The information we want to send

Named group { }
  • buy
    Ordered list [ ]
    • Place 1"apple"text
    • Place 2"pear"text
  • paidfalseyes/no value

What happens if you change this?

Make one change, then watch again. Restart restores the original example.

3 / 3
03
Reach primitive values.

Strings, numbers, booleans, and null terminate branches of the tree.

How can another app read our shopping list?An object value expands into name and flags members, then into string, boolean, and null leaves.A JSON text contains one valueIllustrative value treeobject"name""flags"array [ ]"Ada"truenullObjects and arrays nest; scalar values are leavesRead the scalar values at the leaves

Key idea: JSON writes one value as text, including the relationships between values inside it.

Terms
JSON
JavaScript Object Notation: shared rules for writing data as text. Apps in many languages use it.
Object
A group of named values, like drawers with different labels.
Array
A list whose values have meaningful positions.
String
A text value between quotation marks.
Grammar
Rules for which marks and words may appear and where.
Interoperability
Different apps can read the same data and agree about its meaning.

Look up a term in the glossary ↗

Rules & examples

JSON carries one value and its structure as text.

  • Values are object, array, number, string, true, false, or null. Literal names are lowercase.
  • A top-level text can be any JSON value, including a scalar.
  • Only space, tab, carriage return, and line feed are insignificant JSON whitespace. Comments and trailing commas are outside the grammar.

JSON syntax is language-independent. A JavaScript expression that happens to resemble JSON can still be invalid JSON.

RFC 8259 §§2–3: any JSON value may be the root. Only SP, HTAB, LF and CR are insignificant whitespace. true, false and null are lowercase. Comments and trailing commas are not in the grammar.

Sources
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

First, agree how to read the message.

An encoding tells a reader how to interpret bytes. A format tells it how values fit together. Correctly reading a value does not make that value trustworthy.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

All chapters in RFC 8259

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗