JSON

JSON[28] has become one of the more common data formats for dealing with web applications and data exchange. It’s human-readable, and many resources are available for its use. These two factors make it an attractive option as a data format.

The fundamental concepts in JSON are the object and the array, as the two container types for any values in the data. Objects correspond strongly to Clojure’s hash-maps, being an set of key-value pairs. Arrays are ordered lists of arbitrary data and most closely resemble a vector in Clojure.

If we convert the users.edn file from earlier to users.json, it looks like this:

 
[
 
{"name": ​"Joe Smith"
 
"email"​: ​"joe@company.com"
 
"roles"​: [​"admin"​, ​"supervisor"​, ​"analyst"​]},
 
{"name": ​ ...

Get Clojure Applied now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.