Re: Accessing JSON Array data in Clojure

2013-05-10 Thread Thomas Heller
Hey, I only glanced over the discussion, but I think you have a type problem. Keyword vs. Strings to be precise, the JSON data you pasted will not convert to keyword keys by default I think. So instead of (core/get-in forecast [:dayPrecipitation :temp]) try (core/get-in forecast ["dayPrecipita

Re: Accessing JSON Array data in Clojure

2013-05-10 Thread Michael Klishin
2013/5/10 Bryan Henderson > What map would be defined for the first argument with the given code? It > seems like how it is set up, it is grabbing information straight from the > JSON data without a map defined. > Parsed JSON > The 'format-forecast' definition takes forecast as an arg so I

Re: Accessing JSON Array data in Clojure

2013-05-09 Thread Bryan Henderson
What map would be defined for the first argument with the given code? It seems like how it is set up, it is grabbing information straight from the JSON data without a map defined. The 'format-forecast' definition takes forecast as an arg so I tried it like this with no luck: *:hour-summary (core

Re: Accessing JSON Array data in Clojure

2013-05-09 Thread Michael Klishin
2013/5/10 Hawkeye02 > :hour-summary (core/get-in :dayPrecipitation [:temp] forecast) I don't think you use get-in the way it is demonstrated in the examples. It takes a map as the first argument and a collection of keys to traverse. http://clojuredocs.org/clojure_core/clojure.core/get-in Also

Re: Accessing JSON Array data in Clojure

2013-05-09 Thread Hawkeye02
Forgot to put the JSON data: "radarStation":"lot","dayPrecipitation":[{"time":1368129600,"probability":0.23,"type":"rain","temp":74,"cloudCover":1,"relHumidity":0.45},.. On Thursday, May 9, 2013 4:10:44 PM UTC-5, Hawkeye02 wrote: > > Thanks Greg for the suggestion. I have added the book to

Re: Accessing JSON Array data in Clojure

2013-05-09 Thread Hawkeye02
Thanks Greg for the suggestion. I have added the book to my Safari account. Michael, I tried your suggestion with 'get-in' and it came back with [object Object] from JSON. I switched the clojure.contrib stuff with data.json. Below is the updated code and a screenshot of the result. Thanks in

Re: Accessing JSON Array data in Clojure

2013-05-07 Thread greg r
You might want to check out "Clojure Data Analysis Handbook" by Eric Rochester. There is an example using org.clojure/data.json and Incanter to read JSON format into an Incanter dataset. You might find other recipes in the book useful as well: http://www.packtpub.com/clojure-data-analysis-coo

Re: Accessing JSON Array data in Clojure

2013-05-07 Thread Hawkeye02
Michael, Thank you for the response and references. I will try your suggestions and get back to you. My terminology isn't the best, thanks for deciphering. On Tuesday, May 7, 2013 11:27:01 AM UTC-5, Michael Klishin wrote: > > > 2013/5/7 Hawkeye02 > > >> I can't get the data from inside the

Re: Accessing JSON Array data in Clojure

2013-05-07 Thread Michael Klishin
2013/5/7 Hawkeye02 > I can't get the data from inside the JSON arrays from Clojure. > Specifically, I looking to get the data from the "currently" array taken > from this Dark Sky data: Sorry but your JSON document example does not have arrays. Do you mean nested objects (maps)? Parsed JSON d