Reading and writing JSON in Clojure
Clojure is a modern Lisp variant running on top of the Java and Microsoft Common
Language Runtime (CLR) platforms. As such, you can use the facilities we discussed in Chapter 1, Reading and Writing JSON on the Client, to convert between JSON and objects in the native runtime, but there's a better way, and that is the Clojure's data.json
module, available at https://github.com/clojure/data.json.
Getting ready
To begin, you need to specify your dependency in the data.json
module. You can do this with the following dependency in your Leiningen file:
[org.clojure/data.json "0.2.5"]
If you're using Maven, you'll want this:
<dependency> <groupId>org.clojure</groupId> <artifactId>data.json</artifactId> <version>0.2.5</version> </dependency>
Tip
Of course, the version of data.json
may change between the time I write this and the time you include it in your project as a dependency. Check...