ol.ron
Fast RON (Readable Object Notation) for Clojure.
RON keeps the JSON data model while removing punctuation where the meaning is unambiguous. Pretty output is the default. Compact output preserves available member order, and canonical output implements RFC 8785 and I-JSON.
read-string and read-bytes parse directly into Clojure data.
write-string, write-bytes, and write render Clojure data directly.
ron→json and json→ron preserve number source text outside canonical
mode.
ron→json
(ron->json ron)
(ron->json ron opts)
Converts RON text to JSON text.
Pretty and compact modes preserve parsed member order and number spelling. Canonical mode applies RFC 8785 and I-JSON.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum object/array nesting depth (default |
See also json→ron.
json→ron
(json->ron json)
(json->ron json opts)
Converts JSON text to RON text.
Pretty output is the default and elides non-empty root-object braces. Typed value hooks replace values by path before rendering and do not recurse into a replacement value.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum object/array nesting depth (default |
|
Path replacements with |
See also ron→json.
read-string
(read-string ron)
(read-string ron opts)
Parses RON text directly into Clojure data.
Objects become maps, arrays become vectors, integers become longs or bigints, and decimal/exponent numbers become doubles.
Options:
| key | description |
|---|---|
|
Function applied to every object key (default |
|
Maximum object/array nesting depth (default |
The built-in identity and keyword key functions use cached key paths.
See also read-bytes and write-string.
read-bytes
(read-bytes input)
(read-bytes input opts)
Parses a UTF-8 byte array directly into Clojure data.
Malformed UTF-8 throws ol.ron.Ron$ParseException with a byte offset.
Options:
| key | description |
|---|---|
|
Function applied to every object key (default |
|
Maximum object/array nesting depth (default |
See also read-string and write-bytes.
write-string
(write-string data)
(write-string data opts)
Renders Clojure data directly as RON text.
Map keys may be strings, keywords, or symbols. Values may be nil, booleans, strings, finite numbers, keywords, symbols, maps, and sequential collections.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum collection nesting depth (default |
See also write-bytes and read-string.
write-bytes
(write-bytes data)
(write-bytes data opts)
Renders Clojure data directly as UTF-8 RON bytes.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum collection nesting depth (default |
See also write and write-string.
write
(write data output-stream)
(write data output-stream opts)
Writes UTF-8 RON to output-stream, flushes it, and returns it.
The function does not close the caller’s stream.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum collection nesting depth (default |
See also write-bytes.
ron-bytes→json-bytes
(ron-bytes->json-bytes input)
(ron-bytes->json-bytes input opts)
Converts UTF-8 RON bytes to UTF-8 JSON bytes.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum object/array nesting depth (default |
See also ron→json.
json-bytes→ron-bytes
(json-bytes->ron-bytes input)
(json-bytes->ron-bytes input opts)
Converts UTF-8 JSON bytes to UTF-8 RON bytes.
Options:
| key | description |
|---|---|
|
|
|
Compatibility option used only when |
|
Maximum object/array nesting depth (default |
|
Path replacements with |
See also json→ron.