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} ]
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} ]
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)