Hey all,
I’m trying to fetch weather data using the DarkSky API, and I’m looking for some advice on the best way to work with JSON in Mongoose OS.
- How to call the API and get the response
- I’ve found an example that achieves this using mg_connect_http() and writing the http chunks as they come in to file.
- I’m looking for an example of this could be done in memory
- Once I’ve received the response I need to extract a few specific bits of info from the response. A typical API response is something like this:
}
{
"latitude": 42.3601,
"longitude": -71.0589,
"timezone": "America/New_York",
"currently": {
"time": 1509993277,
"summary": "Drizzle",
"uvIndex": 1,
"visibility": 9.84,
"ozone": 267.44
}
}
As an example I’d like to be able to extract the “timezone” and the “summary” information nested under “currently”.
I’ve been looking at the frozen library but have had zero luck getting anything working.
Any suggestions/ideas/links/tips would be much appreciated.
Thanks.