Skip to content
Clojure library for fast JSON encoding and decoding.
Branch: master
Clone or download
Latest commit 3af8929 Jan 11, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev-resources Import the JSON files used by the perf tests May 30, 2017
docs now 6x faster encode than Cheshire May 1, 2018
src :bigdecimals May 23, 2018
.travis.yml Java1.8+ Apr 30, 2018
LICENSE Update LICENSE Aug 17, 2018 Add a cljdoc badge Oct 12, 2018

jsonista Continuous Integration status cljdoc badge

jsonissa / jsonista / jsoniin, jsonilla / jsonilta / jsonille

Clojure library for fast JSON encoding and decoding.

Much faster than Cheshire while still having all the necessary features for web development. Designed for use with Muuntaja.


Latest version

Clojars Project

Requires Java1.8+


(require '[jsonista.core :as j])

(j/write-value-as-string {"hello" 1})
;; => "{\"hello\":1}"

(j/read-value *1)
;; => {"hello" 1}


Changing how map keys are encoded & decoded:

(defn reverse-string [s] (apply str (reverse s)))

(def mapper
    {:encode-key-fn (comp reverse-string name)
     :decode-key-fn (comp keyword reverse-string)}))

(-> {:kikka "kukka"}
    (doto prn)
    (j/write-value-as-string mapper)
    (doto prn)
    (j/read-value mapper)
; {:kikka "kukka"}
; "{\"akkik\":\"kukka\"}"
; {:kikka "kukka"}

Reading & writing directly into a file:

(def file ( "hello.json"))

(j/write-value file {"hello" "world"})

(slurp file)
;; => "{\"hello\":\"world\"}"

(j/read-value file)
;; => {"hello" "world"}

Adding support for joda-time Classes, used by clj-time.

;; [com.fasterxml.jackson.datatype/jackson-datatype-joda "2.9.5"]
(import '[com.fasterxml.jackson.datatype.joda JodaModule])
(import '[org.joda.time LocalDate])

(def mapper
    {:modules [(JodaModule.)]}))

(j/write-value-as-string (LocalDate. 0) mapper)
; "\"1970-01-01\""


  • All standard encoders and decoders are written in Java
  • Protocol dispatch with read-value & write-value
  • Jackson ObjectMapper is used directly
  • Small functions to support JVM Inlining

See perf-tests for details.




Copyright © 2016-2018 Metosin Oy.

Distributed under the Eclipse Public License 2.0.

You can’t perform that action at this time.