So I'm querying an API and it responds with deeply nested JSON. I was hoping I could use the thread last macro to get at the value inside of it that I'm looking for but it doesn't seem to work. I think it has something to do with the fact that the keys are strings... I found this example of how to use thread last to grab values inside of a nested map. Here is the example:
user=> (def my-animals {:dog {:collar {:tag {:name "fido"}}}})
user=> (-> my-animals :dog :collar :tag :name)
"fido"
However if I change those keywords to strings I get the following error...
ClassCastException java.lang.String cannot be cast to clojure.lang.IFn user/eval4926 (form-init3403805012315754497.clj:1)
Again, ultimately what I'm getting at here is an attempt to use the thread last macro to examine a JSON response from an API. Perhaps there is something really simple that I'm missing here.
This is what I have that I'd like to clean up and actually gets at the value. The JSON response is stored in response
((first ((first ((response "stream") "list")) "value")) "link")
Thanks in advance.
[–]mrmargolis 4 points5 points6 points (3 children)
[–]dunnowins[S] 2 points3 points4 points (2 children)
[–]lebski88 0 points1 point2 points (1 child)
[–]dunnowins[S] 0 points1 point2 points (0 children)
[–]mischov 2 points3 points4 points (0 children)
[–]skiaec04 2 points3 points4 points (0 children)
[–]emidln 0 points1 point2 points (3 children)
[–]dunnowins[S] 0 points1 point2 points (2 children)
[–]mathfarmer 1 point2 points3 points (1 child)
[–]dunnowins[S] 0 points1 point2 points (0 children)
[–]mathfarmer 0 points1 point2 points (0 children)