JSON for dual-host Clojure.
ENCODE is pure portable Clojure — deliberately NOT delegated to a host
library. Measured on 2026-07-27, Go's encoding/json and JVM
clojure.data.json disagree on 4 of 6 basic payloads (key order, HTML
escaping, float formatting, unicode escaping). Controlling those three
choices IS the whole encoder, so we own it and both hosts agree by
construction.
DECODE is also pure portable Clojure. Delegating it looked free (parsing has no formatting choices to disagree about) but with four hosts it would mean four parsers to keep in agreement, two of which are not even reachable.
JSON for dual-host Clojure. ENCODE is pure portable Clojure — deliberately NOT delegated to a host library. Measured on 2026-07-27, Go's `encoding/json` and JVM `clojure.data.json` disagree on 4 of 6 basic payloads (key order, HTML escaping, float formatting, unicode escaping). Controlling those three choices IS the whole encoder, so we own it and both hosts agree by construction. DECODE is also pure portable Clojure. Delegating it looked free (parsing has no formatting choices to disagree about) but with four hosts it would mean four parsers to keep in agreement, two of which are not even reachable.
(read-str s)(read-str s {:keys [key-fn] :or {key-fn keyword}})Parse a JSON string into Clojure data. Object keys become keywords unless
:key-fn is supplied (pass str to keep them as strings).
Parse a JSON string into Clojure data. Object keys become keywords unless `:key-fn` is supplied (pass `str` to keep them as strings).
(write-str x)Encode Clojure data as a JSON string. Object keys are sorted; non-ASCII is emitted literally. Deterministic and identical on every host.
Encode Clojure data as a JSON string. Object keys are sorted; non-ASCII is emitted literally. Deterministic and identical on every host.
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 |