Skip to content

std:json/JSON

Canonical occurrence: protos/lib/json/JSON.protos · Protos revision: e99b712ecf658a527b1fe82c8beba2c1286d8dc9.

JSON node trees, whole-text parsing and encoding, and incremental event parsing and writing. Nodes are objects with kind and value slots; numbers are exact decimals of an Integer coefficient and Integer exponent.

This page lists the complete mechanically observable top-level slot inventory required by D067. Authored documentation, when present, is canonical D062 prose; mechanical presence alone does not create a stability or compatibility promise.

Answers a fresh JSON array node of nodes; each argument must have one of the six JSON node kinds.

Answers a fresh JSON boolean node; value must be canonical true or false.

Encodes the node tree root as compact JSON text. An invalid or cyclic node signals an Error.

Answers an incremental parser whose feed(text) consumes JSON text and whose finish() ends the input, calling emit(event) with events of kind objectStart, objectEnd, arrayStart, arrayEnd, name, null, boolean, string, or number and their value. Malformed input, an emit failure, or use after finish() signals an Error and leaves the parser terminal.

Answers an incremental writer whose feed(event) accepts the events produced by eventParser and calls emit(text) with each encoded chunk, and whose finish() requires one complete document. Invalid event sequences, an emit failure, or use after finish() signals an Error and leaves the writer terminal.

Answers a fresh JSON null node.

Answers a fresh JSON number node of value coefficient × 10^exponent; both must be Integers.

Answers a fresh JSON object node from alternating String names and nodes. A duplicate name, a non-String name, a non-node value, or a missing final value signals an Error.

Parses one complete JSON text into a node tree. Malformed text, trailing content, or a duplicate object name signals an Error.

Answers an adapter whose read() reads one chunk from textReader, feeds it to an eventParser(emit), and answers a Future of true, or of false once the input has ended and been finished. Calling read() while a read is pending or after the end signals an Error.

Answers a fresh JSON string node; value must be a String.

Answers an adapter whose feed(event) encodes one event and writes it to textWriter, and whose finish() requires one complete document and then performs an ordered zero-output write; both answer a Future of the adapter. The adapter does not close textWriter.

Exact module source · Standard-library API · Standard library overview