Visual RFC.
ALL RFCs / RFC 8259
Read the RFC ↗
RFC 8259 / INTEROPERABLE EXCHANGE

Does readable data give permission to act?

05

Follow an untrusted request through a reader, a strict writer and a separate permission gate.

RFC 8259 · § 9EXAMPLE
1 / 4 · An outside note arrives

The visitor asks to feed the cat. The note is untrusted data; reading it must not run it as a program.

An untrusted note, not a program

{"feed":"cat"}
Visitor → app reader

Reading a note does not execute its words.

What happens if you change this?

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

3 / 3
03
Serialize back to conforming text.

Output uses quoted member names and valid separators, even if the input parser tolerated extensions.

Does readable data give permission to act?JSON tokens become a value tree, and a generator emits strict JSON with quoted member names, separating parsing from source-code execution.Parse data, then generate strict JSONIllustrative object with one member{"count": 3}parseobject"count" → 3value treegenerate{"count":3}Strict output · no eval · apply application validationGenerate text that follows JSON grammar strictly

Key idea: Read data with a parser, write it with a generator, and check permission separately before acting.

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.
Parser
A reader that turns text into usable values.
Generator
A writer that turns usable values into correctly spelled JSON text.
Nesting depth
How many containers are inside other containers along the deepest branch.

Look up a term in the glossary ↗

Rules & examples

JSON is data; the app must decide what actions are allowed.

  • A parser must accept conforming JSON texts, subject to the permitted implementation limits on size, depth, strings, and numbers.
  • A parser may accept extensions, but generators must emit text that strictly conforms to JSON grammar.
  • Do not use eval or an equivalent source-code execution mechanism to parse untrusted JSON.

Successful syntax parsing is separate from application schema validation, authorization, and safe use of values. Put practical input limits around untrusted data.

RFC 8259 §§9–10: parsers MUST accept conforming texts subject to permitted limits (size, depth, number range/precision and string contents/length); they MAY accept extensions. Generators MUST emit strict JSON. Our optional extension accepts only the one displayed final-comma fixture, not arbitrary relaxed syntax. The 3-level limit is chosen for this lesson. §12 warns against eval-like execution of input. Permission is a separate example application policy.

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 ↗