std:json/JSON
std:json/JSON
Section titled “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.
Observable top-level slots
Section titled “Observable top-level slots”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.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters: none
-
Rest parameter:
nodes -
Source occurrence:
protos/lib/json/JSON.protos:79 -
Exact source page: open in the source browser
boolean
Section titled “boolean”Answers a fresh JSON boolean node; value must be canonical true or false.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
value -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:29 -
Exact source page: open in the source browser
encode
Section titled “encode”Encodes the node tree root as compact JSON text. An invalid or cyclic node
signals an Error.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
root -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:1034 -
Exact source page: open in the source browser
eventParser
Section titled “eventParser”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.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
emit -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:1240 -
Exact source page: open in the source browser
eventWriter
Section titled “eventWriter”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.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
emit -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:2131 -
Exact source page: open in the source browser
nullValue
Section titled “nullValue”Answers a fresh JSON null node.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters: none
-
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:21 -
Exact source page: open in the source browser
number
Section titled “number”Answers a fresh JSON number node of value coefficient × 10^exponent; both must
be Integers.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
coefficient,exponent -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:58 -
Exact source page: open in the source browser
object
Section titled “object”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.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters: none
-
Rest parameter:
nameNodePairs -
Source occurrence:
protos/lib/json/JSON.protos:104 -
Exact source page: open in the source browser
Parses one complete JSON text into a node tree. Malformed text, trailing content, or a duplicate object name signals an Error.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
text -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:155 -
Exact source page: open in the source browser
readEvents
Section titled “readEvents”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.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
textReader,emit -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:2450 -
Exact source page: open in the source browser
string
Section titled “string”Answers a fresh JSON string node; value must be a String.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
value -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:45 -
Exact source page: open in the source browser
writeEvents
Section titled “writeEvents”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.
Mechanical facts
Section titled “Mechanical facts”-
Fixed parameters:
textWriter -
Rest parameter: none
-
Source occurrence:
protos/lib/json/JSON.protos:2499 -
Exact source page: open in the source browser
Exact module source · Standard-library API · Standard library overview