Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose a Clojure JSON library [closed]

Tags:

json

clojure

There are multiple JSON parser/writer libraries available for Clojure, including:

  • clojure/data.json
  • cheshire
  • clj-json

What are the pros and cons of each, especially regarding speed, memory footprint, and programming convenience? Are there any other important factors to consider?

like image 286
Lars Trieloff Avatar asked Feb 03 '14 05:02

Lars Trieloff


1 Answers

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).

like image 198
Isaac Avatar answered Sep 29 '22 01:09

Isaac