JSON encode/decode with a runtime-selected backend. The JVM artifact ships charred; Babashka uses its bundled cheshire.
Preference order on the JVM:
Under Babashka only cheshire is used: charred and data.json do not load under SCI. Compact output disables slash/unicode escaping where the backend supports it so it stays byte-stable across runtimes; pretty output layout may still differ between backends.
JSON encode/decode with a runtime-selected backend. The JVM artifact ships charred; Babashka uses its bundled cheshire. Preference order on the JVM: 1. charred — reflection-free, GraalVM native-image friendly (no Jackson); 2. clojure.data.json; 3. cheshire. Under Babashka only cheshire is used: charred and data.json do not load under SCI. Compact output disables slash/unicode escaping where the backend supports it so it stays byte-stable across runtimes; pretty output layout may still differ between backends.
(read-str s & {:keys [key-fn] :or {key-fn identity}})Parse a JSON string into Clojure data. :key-fn maps object keys (default
identity, i.e. string keys); pass keyword to keywordize.
Parse a JSON string into Clojure data. `:key-fn` maps object keys (default `identity`, i.e. string keys); pass `keyword` to keywordize.
(write-pretty-str data)Serialize data to an indented JSON string.
Serialize `data` to an indented JSON string.
(write-str data)Serialize data to a compact JSON string.
Serialize `data` to a compact JSON string.
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 |