JSON Weather Patch Question
Hey, i'm a total beginner in Max and I have a question regarding the JSON weather Patch that came with the Ableton Live Connection Kit:
How can I get more values (such as humidity, precipProbability, moonPhase, pressure and ozone) from the dictionary. temperature, windspeed, precipIntensity and cloudCover are working... every time i try with another value, i'm not getting a result. What am I missing?
if you look at the dictionary output from the marurl request, you can see that moonPhase is a key inside of of the body::daily::data subdictionary array. therefore in order to retrieve that you have to process the array of dictionaries in some way. JS is the preferred solution for this, turning the dictionary into a javascript object with something like the following : var jsob = JSON.parse(maxdict.stringify());
but you can process with max objects as well. the trick is to grab the dictionary name of whatever instance you are interested in, sending that to a dict object and then retrieving the key.
Great, thanks!!
But why doesn't it work for the "currently" array? Why does it seem to recognize temperature, windSpeed, cloudCover and precipitationIntensity only, and not others?
again, look at the data you are getting. there is no "moonPhase" entry in the "currently" sub-dict. it only appears in the "daily" sub-dict's "data" array.
I know, what I meant was I did not figure out how to get other entries from the "currently" array. But I figured it out now - there is a subpatch (p query_Data) which specifies which elements can be read using a get:body message.
Hello ppl :)
I have a question, what I need achange in [zl.slice 1] to read 5th object in "body::daily::data" data array? Or maybe batter question is how can I read last article in data array?
Thank you!
it's just simple list processing to get the dictionary name that you are interested, either zl objects or unpack.
i think the easiest solution for this is to send the data array into an [ unpack s s s s s ]
@rob Ramiez
Thank you so much!