JSON on both platforms, without a library: a strict reader by RFC 8259 on the JVM, and the JSON of JavaScript in ClojureScript.
An object reads as a map with keyword keys, unless a :key-fn says otherwise, an array as a vector, and a number as a long when it's an integer that fits, or else as a double. In JavaScript every number is a double, so an integer past 2^53 loses its last digits there.
JSON on both platforms, without a library: a strict reader by RFC 8259 on the JVM, and the JSON of JavaScript in ClojureScript. An object reads as a map with keyword keys, unless a :key-fn says otherwise, an array as a vector, and a number as a long when it's an integer that fits, or else as a double. In JavaScript every number is a double, so an integer past 2^53 loses its last digits there.
How deep the arrays and objects of a JSON text may nest, so that a hostile text can't use up the stack.
How deep the arrays and objects of a JSON text may nest, so that a hostile text can't use up the stack.
(read-json s)(read-json s {:keys [key-fn] :or {key-fn keyword} :as opts})The value of the JSON text s, read by the opts below, or nil when s
isn't JSON or nests deeper than max-depth.
The opts are :key-fn, a function of the name of each member of an
object that gives its key, keyword by default.
The value of the JSON text `s`, read by the `opts` below, or nil when `s` isn't JSON or nests deeper than max-depth. The `opts` are :key-fn, a function of the name of each member of an object that gives its key, keyword by default.
(write-json x)The JSON text of the value x: a map as an object, with keywords as
their names, namespace and all, a vector, a list or a set as an array,
an instant as its date and time in UTC, and a number that isn't finite
as null, as JavaScript writes it.
The JSON text of the value `x`: a map as an object, with keywords as their names, namespace and all, a vector, a list or a set as an array, an instant as its date and time in UTC, and a number that isn't finite as null, as JavaScript writes it.
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 |