1

Through a Jsonp call I fetch some (json) data from a remote api, response:

#js [#js {:id 1501} #js {:id 1502}]

How do I turn them into a clojurescript vector with maps inside?

i.e.

[ {:id 1501} {:id 1502} ]
Frank C.
  • 7,758
  • 4
  • 35
  • 45
Seneca
  • 2,392
  • 2
  • 18
  • 33

1 Answers1

3

js->clj will convert it to a clojurescript vector. Add :keywordize-keys true and you'll get the maps inside.

Like this:

(def json #js [#js {:id 1501} #js {:id 1502}])
(js->clj json :keywordize-keys true)
KayakDave
  • 24,636
  • 3
  • 65
  • 68
  • Be sure not to use defonce here instead of def because the {:keywordize-keys true} option won't work. – reus Jun 11 '16 at 10:03