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

Objects and arrays

02

Object members map string names to values. Arrays retain an ordered sequence of elements.

Related RFCs and changes

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

DIAGRAM§ 4 ↗
RFC 8259 · § 4EXAMPLE
3 / 3
Objects and arraysObject members are selected by string names, array elements by ordered position; duplicate object names are shown as an interoperability hazard.Objects use names; arrays use positionsIllustrative JSON structures"name": "Ada","active": trueRead a member by its name, not its display order[]"red"index 03index 1trueindex 2{"role":"reader", "role":"admin"}Duplicate names: consumers may disagreePrefer unique names for interoperable mappings
03
Avoid ambiguous mappings.

Two members named role can produce different results in different implementations.

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
KEY POINT

Use names for members and positions for ordered elements.

  • Object names are strings; a colon separates name and value, and commas separate members. Names should be unique.
  • An array is ordered, can be empty, and may mix value types.
  • Applications that depend on object-member order are less interoperable because parsers expose that order differently.
DETAILS

Duplicate object names can be accepted by the grammar but produce incompatible consumer behavior: last value, all values, or an error. Use unique names to avoid this ambiguity.

Read the RFC section ↗

Diagrams simplify the RFC. Read the linked sections for complete requirements.

Privacy
All chapters in this RFC
  1. A tree of JSON values
  2. Objects and arrays
  3. Strings and Unicode
  4. Numbers and precision
  5. Parsing and generating
  6. Interoperability checks
RFC 9700 / CHAPTERS

Chapters

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

RFC status and corrections ↗