-
5 Mar 2012 7:57 AM #1
Answered: Modeling semi-complicated json structures
Answered: Modeling semi-complicated json structures
Hello,
I'm trying to read a json feed from yahoo weather. Seems like a pretty simple response, but I can't figure out the approach I should use to bring the data into my model. I was thinking jsonReader might be key, but it doesn't seem to support the format. Any help would be appreciated. Thanks. Here the response:
Code:{ "units": { "temperature": "F", "speed": "mph", "distance": "mi", "pressure": "in" }, "location": { "location_id": "USLA0338", "city": "New Orleans", "state_abbreviation": "LA", "country_abbreviation": "US", "elevation": 13, "latitude": 29.97000000000000, "longitude": -90.09000000000000 }, "wind": { "speed": 10.00000000000000, "direction": "WNW" }, "atmosphere": { "humidity": "67", "visibility": "10", "pressure": "30.39", "rising": "rising" }, "url": "http:\/\/weather.yahoo.com\/forecast\/USLA0338.html", "logo": "http:\/\/l.yimg.com\/a\/i\/us\/nt\/ma\/ma_nws-we_1.gif", "astronomy": { "sunrise": "06:21", "sunset": "18:03" }, "condition": { "text": "Fair", "code": "34", "image": "http:\/\/l.yimg.com\/a\/i\/us\/we\/52\/34.gif", "temperature": 62.00000000000000 }, "forecast": [{ "day": "Today", "condition": "Sunny", "high_temperature": "72", "low_temperature": "52" }, { "day": "Tomorrow", "condition": "Mostly Sunny", "high_temperature": "70", "low_temperature": "62" }] }
-
Best Answer Posted by mitchellsimoens
A Store needs an array so this response wouldn't work. You could use a store and get the forecasts but the other info wouldn't be part of any record.
-
5 Mar 2012 8:28 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,682
- Vote Rating
- 435
- Answers
- 3111
A Store needs an array so this response wouldn't work. You could use a store and get the forecasts but the other info wouldn't be part of any record.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Mar 2012 8:49 AM #3
Thanks for the reply. Is there no way to massage the data prior to ingest? It seems like this would be something that would commonly need to be done.


Reply With Quote