I’ve used http-kit in the past to get the response as a string via the :body key in the response map. You can then parse that JSON string into a clojure map using some libraries and work from there in clojure.
One approach is to use a library like data.json or cheshire or plenty of other clojure JSON handling libraries to parse the JSON request into a clojure map. Then just walk the map to find the :objectNumbers keys. It looks like you just need to get the collection of art objects from the map, so if it we call it parsed-map
, then
(def art-records (get parsed-map :artObjects))
should return a vector of maps. Then just process those to get the the keys you want and build up any references you need (or maybe just store the records in a map, e.g.
(reduce (fn [acc r] (assoc acc (get r :objectNumber) r)) {} art-records)
Now you can lookup all the information for each one (you could also use the :title as the key instead if that makes more sense) as a nested map of maps.
It looks like there’s already a key under the path [:links :self] like https://www.rijksmuseum.nl/api/nl/collection/SK-A-1505
that may be useful too. So you may not have to do any additional parsing, or maybe just use the URL they provide and modify it to suit your needs.
There are additional libraries and techniques (even from clojure.core) that can help with parsing very complicated nested data, but this case looks simple. I think these libraries or analogues are available in cljs as well, so you could probably have a browser-based SPA as well and maybe learn some additional tools later (like re-frame or reagent for ui stuff).