Last active
December 26, 2015 22:09
-
-
Save johnwalker/7220723 to your computer and use it in GitHub Desktop.
testing json reading in clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { | |
"status": 200, | |
"msg": "OK" | |
}, | |
"response": { | |
"total_blogs": 15, | |
"blogs": [ | |
{ | |
"name": "twosillycorgis", | |
"title": "My Two Silly Corgis: Ed and Jiggles", | |
"url": "http://twosillycorgis.tumblr.com/", | |
"updated": 1383011079 | |
}, | |
{ | |
"name": "mensweardog", | |
"title": "Menswear Dog", | |
"url": "http://mensweardog.tumblr.com/", | |
"updated": 1382746486 | |
}, | |
{ | |
"name": "the0riginalrumpshaker", | |
"title": "Strange since '92", | |
"url": "http://the0riginalrumpshaker.tumblr.com/", | |
"updated": 1383035678 | |
}, | |
{ | |
"name": "nine-divines", | |
"title": "", | |
"url": "http://nine-divines.tumblr.com/", | |
"updated": 1382894261 | |
}, | |
{ | |
"name": "shibabab", | |
"title": "", | |
"url": "http://shibabab.tumblr.com/", | |
"updated": 1382992472 | |
}, | |
{ | |
"name": "wowsodoge", | |
"title": "Doge", | |
"url": "http://wowsodoge.tumblr.com/", | |
"updated": 1382851101 | |
}, | |
{ | |
"name": "reallysickburns", | |
"title": "To Recap:", | |
"url": "http://reallysickburns.tumblr.com/", | |
"updated": 1382969452 | |
}, | |
{ | |
"name": "yungshibainu", | |
"title": "", | |
"url": "http://yungshibainu.tumblr.com/", | |
"updated": 1382904716 | |
}, | |
{ | |
"name": "johndarnielle", | |
"title": "William Caxton Fan Club", | |
"url": "http://johndarnielle.tumblr.com/", | |
"updated": 1382991269 | |
}, | |
{ | |
"name": "skurrah", | |
"title": "Anthems for a twenty year old girl.", | |
"url": "http://skurrah.tumblr.com/", | |
"updated": 1382984217 | |
}, | |
{ | |
"name": "watchingthethr0ne", | |
"title": "sunglasses and advil", | |
"url": "http://watchingthethr0ne.tumblr.com/", | |
"updated": 1383069086 | |
}, | |
{ | |
"name": "vzap", | |
"title": "Shenanigans", | |
"url": "http://vzap.tumblr.com/", | |
"updated": 1382941085 | |
}, | |
{ | |
"name": "parislemon", | |
"title": "ParisLemon", | |
"url": "http://parislemon.com/", | |
"updated": 1383069370 | |
}, | |
{ | |
"name": "staff", | |
"title": "Tumblr Staff", | |
"url": "http://staff.tumblr.com/", | |
"updated": 1382734291 | |
} | |
] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns jsontest.jsonexperiment | |
(require [clojure.data.json :as json] | |
[clojure.java.io :as io] | |
[clojure.walk :as walk])) | |
(defn -main [] | |
(let [raw-string (slurp (-> "goodstuff.json" io/resource io/file)) | |
json (walk/keywordize-keys (json/read-str raw-string))] | |
(map (fn [x] (println (:name x))) (-> json :response :blogs)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment