Skip to content

Instantly share code, notes, and snippets.

@weissjeffm
Created February 24, 2011 19:31
Show Gist options
  • Select an option

  • Save weissjeffm/842717 to your computer and use it in GitHub Desktop.

Select an option

Save weissjeffm/842717 to your computer and use it in GitHub Desktop.
Example of parsing JSON in clojure - extract the array of numbers in the nested structure and add them up.
(def my-json "[\"zero\" \"first\" \"second\" {\"name\": \"third\" \"value\": [100 20 30]}]")
(-> (json/read-json myjson true) (nth 3) :value (->> (apply +)))
;; -> 150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment