There are multiple JSON parser/writer libraries available for Clojure, including:
What are the pros and cons of each, especially regarding speed, memory footprint, and programming convenience? Are there any other important factors to consider?
I decided to run a little shootout (the link is to results and the code used to test).
In terms of speed, clj-json
is the fastest, 1.7x cheshire
, and 5.6x clojure.data.json
for a simple parse/generate task.
clojure.data.json
has the smallest footprint, and clj-json
and cheshire
follow. cheshire
has some superb features, though, and is my preferred library for dealing with JSON. You get support for SMILE, as well as a lovely interface for interpreting JSON (adding types, special rules on keys, etc) and custom encoders (the last also found in clojure.data.json
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With