Parsing and generating
05A parser builds an internal representation from text. A generator must produce text that strictly follows JSON grammar.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
DIAGRAM§ 9 ↗
RFC 8259 · § 9EXAMPLE
3 / 3
03
Serialize back to conforming text.
Output uses quoted member names and valid separators, even if the input parser tolerated extensions.
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
Read the updated RFC section ↗
Treat input as data and generate strict syntax.
- 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.
Read the RFC section ↗Diagrams simplify the RFC. Read the linked sections for complete requirements.
Privacy