A small, dependency-free JSON reader and writer.
Objects read as maps with string keys, so documents can be written back in canonical form exactly. Two writers:
(write-canonical x) two-space indentation, one key or element per line, keys sorted at every level, final line feed; the form PSOSF requires for manifest.json, signatures.json and test.json (write-compact x) no insignificant whitespace, keys sorted; the form PSOSF requires for line 3 styles
Non-ASCII characters are written as UTF-8, never escaped.
A small, dependency-free JSON reader and writer.
Objects read as maps with string keys, so documents can be written back in
canonical form exactly. Two writers:
(write-canonical x) two-space indentation, one key or element per line,
keys sorted at every level, final line feed; the form
PSOSF requires for manifest.json, signatures.json and
test.json
(write-compact x) no insignificant whitespace, keys sorted; the form PSOSF
requires for line 3 styles
Non-ASCII characters are written as UTF-8, never escaped.The deepest nesting of arrays and objects read. PSOSF's JSON needs only a few levels; the limit keeps a hostile document from exhausting the stack.
The deepest nesting of arrays and objects read. PSOSF's JSON needs only a few levels; the limit keeps a hostile document from exhausting the stack.
The largest integer every platform represents exactly: 2^53 - 1, the limit of a JavaScript number. Integers beyond it are refused, so the JVM, .NET and JavaScript never read the same text as different numbers.
The largest integer every platform represents exactly: 2^53 - 1, the limit of a JavaScript number. Integers beyond it are refused, so the JVM, .NET and JavaScript never read the same text as different numbers.
(read-str s)Parses a JSON document. Throws ex-info with :psosf/json-error on bad input.
Parses a JSON document. Throws ex-info with :psosf/json-error on bad input.
(write-canonical x)Canonical JSON: two-space indentation, one key or element per line, keys sorted at every level, and a final line feed.
Canonical JSON: two-space indentation, one key or element per line, keys sorted at every level, and a final line feed.
(write-compact x)Compact JSON with keys sorted at every level.
Compact JSON with keys sorted at every level.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |