cheshire.core documentation

Main encoding and decoding namespace.

eof

Object used to determine end of lazy parsing attempt.

generate-smile

(generate-smile obj)(generate-smile obj opt-map)
Returns a SMILE-encoded byte-array for the given Clojure object.
Takes an optional date format string that Date objects will be encoded with.

The default date format (in UTC) is: yyyy-MM-dd'T'HH:mm:ss'Z'

generate-stream

(generate-stream obj writer)(generate-stream obj writer opt-map)
Returns a BufferedWriter for the given Clojure object with the.
JSON-encoded data written to the writer. Takes an optional date
format string that Date objects will be encoded with.

The default date format (in UTC) is: yyyy-MM-dd'T'HH:mm:ss'Z'

generate-string

(generate-string obj)(generate-string obj opt-map)
Returns a JSON-encoding String for the given Clojure object. Takes an
optional date format string that Date objects will be encoded with.

The default date format (in UTC) is: yyyy-MM-dd'T'HH:mm:ss'Z'

parse-smile

(parse-smile bytes & [key-fn array-coerce-fn])
Returns the Clojure object corresponding to the given SMILE-encoded bytes.
An optional key-fn argument can be either true (to coerce keys to keywords),
false to leave them as strings, or a function to provide custom coercion.

The array-coerce-fn is an optional function taking the name of an array field,
and returning the collection to be used for array values.

parse-stream

(parse-stream rdr & [key-fn array-coerce-fn])
Returns the Clojure object corresponding to the given reader, reader must
implement BufferedReader. An optional key-fn argument can be either true (to
coerce keys to keywords),false to leave them as strings, or a function to
provide custom coercion.

The array-coerce-fn is an optional function taking the name of an array field,
and returning the collection to be used for array values.
If laziness is needed, see parsed-seq.

parse-string

(parse-string string & [key-fn array-coerce-fn])
Returns the Clojure object corresponding to the given JSON-encoded string.
An optional key-fn argument can be either true (to coerce keys to keywords),
false to leave them as strings, or a function to provide custom coercion.

The array-coerce-fn is an optional function taking the name of an array field,
and returning the collection to be used for array values.

parsed-seq

(parsed-seq reader & [key-fn array-coerce-fn])
Returns a lazy seq of Clojure objects corresponding to the JSON read from
the given reader. The seq continues until the end of the reader is reached.

The array-coerce-fn is an optional function taking the name of an array field,
and returning the collection to be used for array values.
If non-laziness is needed, see parse-stream.

parsed-smile-seq

(parsed-smile-seq reader & [key-fn array-coerce-fn])
Returns a lazy seq of Clojure objects corresponding to the SMILE read from
the given reader. The seq continues until the end of the reader is reached.

The array-coerce-fn is an optional function taking the name of an array field,
and returning the collection to be used for array values.