Skip to main content

Module json

Module json 

Source
Expand description

JSON.

JSON.stringify is specified in terms of a serialisation state that the indentation threads through, and the output is compared byte for byte by the reference test suite — including the trailing-newline-free format with indent and the exact placement of ": ". That is why the writer below is explicit about separators rather than leaning on a generic pretty-printer.

JSON.parse accepts the strict JSON grammar; the reference also accepts a few extensions, but nothing here depends on them.

Functions§

install
Install JSON.
parse_text
Parse text, either as RFC 8259 JSON or in the extended dialect.