Liking cljdoc? Tell your friends :D

insilica.canonical-json

JavaScript Object Notation (JSON) parser/generator. See http://www.json.org/

JavaScript Object Notation (JSON) parser/generator.
See http://www.json.org/
raw docstring

char-seqclj

(char-seq s)
(char-seq s offset)

Return a seq of the characters in a string, making sure not to split up UCS-2 (or is it UTF-16?) surrogate pairs. Because JavaScript. And Java.

Based on https://lambdaisland.com/blog/12-06-2017-clojure-gotchas-surrogate-pairs Modified to handle lone surrogates, which are valid in JSON strings.

Return a seq of the characters in a string, making sure not to split up
UCS-2 (or is it UTF-16?) surrogate pairs. Because JavaScript. And Java.

Based on https://lambdaisland.com/blog/12-06-2017-clojure-gotchas-surrogate-pairs
Modified to handle lone surrogates, which are valid in JSON strings.
sourceraw docstring

codepoint-decoderclj

source

compare-by-codepointclj

(compare-by-codepoint s1 s2)
source

default-read-optionsclj

source

default-write-optionsclj

source

invalid-array-exceptionclj

(invalid-array-exception)
source

JSONWritercljprotocol

-writeclj

(-write object out options)

Print object to Appendable out as JSON

Print object to Appendable out as JSON
source

pprintclj

(pprint x & {:as options})

Pretty-prints JSON representation of x to out. Options are the same as for write except :value-fn, which is not supported.

Pretty-prints JSON representation of x to *out*. Options are the
same as for write except :value-fn, which is not supported.
sourceraw docstring

re-sci-notationclj

source

readclj

(read reader & {:as options})

Reads a single item of JSON data from a java.io.Reader. Options are key-value pairs, valid options are:

:eof-error? boolean

  If true (default) will throw exception if the stream is empty.

:eof-value Object

  Object to return if the stream is empty and eof-error? is
  false. Default is nil.

:key-fn function

  Single-argument function called on JSON property names; return
  value will replace the property names in the output. Default
  is clojure.core/identity, use clojure.core/keyword to get
  keyword properties.

:throw-on-extra-input? boolean

 If true, will throw an exception if the stream is not empty after
 reading one item.

:value-fn function

  Function to transform values in maps ("objects" in JSON) in
  the output. For each JSON property, value-fn is called with
  two arguments: the property name (transformed by key-fn) and
  the value. The return value of value-fn will replace the value
  in the output. If value-fn returns itself, the property will
  be omitted from the output. The default value-fn returns the
  value unchanged. This option does not apply to non-map
  collections.
Reads a single item of JSON data from a java.io.Reader. Options are
key-value pairs, valid options are:

   :eof-error? boolean

      If true (default) will throw exception if the stream is empty.

   :eof-value Object

      Object to return if the stream is empty and eof-error? is
      false. Default is nil.

   :key-fn function

      Single-argument function called on JSON property names; return
      value will replace the property names in the output. Default
      is clojure.core/identity, use clojure.core/keyword to get
      keyword properties.

   :throw-on-extra-input? boolean

     If true, will throw an exception if the stream is not empty after
     reading one item.

   :value-fn function

      Function to transform values in maps ("objects" in JSON) in
      the output. For each JSON property, value-fn is called with
      two arguments: the property name (transformed by key-fn) and
      the value. The return value of value-fn will replace the value
      in the output. If value-fn returns itself, the property will
      be omitted from the output. The default value-fn returns the
      value unchanged. This option does not apply to non-map
      collections.
sourceraw docstring

read-strclj

(read-str string & {:as options})

Reads one JSON value from input String. Options are the same as for read.

Reads one JSON value from input String. Options are the same as for
read.
sourceraw docstring

writeclj

(write x writer & {:as options})

Write JSON-formatted output to a java.io.Writer. Options are key-value pairs, valid options are:

:sql-date-converter function

Single-argument function used to convert a java.sql.Date to
a java.time.Instant. As java.sql.Date does not have a
time-component (which is required by java.time.Instant), it needs
to be computed. The default implementation, `default-sql-date->instant-fn`
uses
```
   (.toInstant (.atStartOfDay (.toLocalDate sql-date) (java.time.ZoneId/systemDefault)))
```

:date-formatter

 A java.time.DateTimeFormatter instance, defaults to DateTimeFormatter/ISO_INSTANT

:key-fn function

 Single-argument function called on map keys; return value will
 replace the property names in the output. Must return a
 string. Default calls clojure.core/name on symbols and
 keywords and clojure.core/str on everything else.

:value-fn function

 Function to transform values in maps before writing. For each
 key-value pair in an input map, called with two arguments: the
 key (BEFORE transformation by key-fn) and the value. The
 return value of value-fn will replace the value in the output.
 If the return value is a number, boolean, string, or nil it
 will be included literally in the output. If the return value
 is a non-map collection, it will be processed recursively. If
 the return value is a map, it will be processed recursively,
 calling value-fn again on its key-value pairs. If value-fn
 returns itself, the key-value pair will be omitted from the
 output. This option does not apply to non-map collections.
Write JSON-formatted output to a java.io.Writer. Options are
key-value pairs, valid options are:

 :sql-date-converter function

    Single-argument function used to convert a java.sql.Date to
    a java.time.Instant. As java.sql.Date does not have a
    time-component (which is required by java.time.Instant), it needs
    to be computed. The default implementation, `default-sql-date->instant-fn`
    uses
    ```
       (.toInstant (.atStartOfDay (.toLocalDate sql-date) (java.time.ZoneId/systemDefault)))
    ```

 :date-formatter

     A java.time.DateTimeFormatter instance, defaults to DateTimeFormatter/ISO_INSTANT

 :key-fn function

     Single-argument function called on map keys; return value will
     replace the property names in the output. Must return a
     string. Default calls clojure.core/name on symbols and
     keywords and clojure.core/str on everything else.

 :value-fn function

     Function to transform values in maps before writing. For each
     key-value pair in an input map, called with two arguments: the
     key (BEFORE transformation by key-fn) and the value. The
     return value of value-fn will replace the value in the output.
     If the return value is a number, boolean, string, or nil it
     will be included literally in the output. If the return value
     is a non-map collection, it will be processed recursively. If
     the return value is a map, it will be processed recursively,
     calling value-fn again on its key-value pairs. If value-fn
     returns itself, the key-value pair will be omitted from the
     output. This option does not apply to non-map collections.
sourceraw docstring

write-strclj

(write-str x & {:as options})

Converts x to a JSON-formatted string. Options are the same as write.

Converts x to a JSON-formatted string. Options are the same as
write.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close