JSON parsing samples

I am looking for some samples of how to parse a JSON string that I get from openweathermap.

Example JSON from here:

https://api.openweathermap.org/data/2.5/onecall?lat=-32.134014&lon=115.805813&units=metric&exclude=hourly&appid=(your app id here)

I was using XML but the 7 day weather reply is in JSON format only.

are you looking for 7 day of for 1 day ?

Actual State

next 5 day (for each 3 hours) on XML

turning to xml
adding metric

Thanks for those links. I didn’t spot the XML 7 day format. I had the 1st one working and then wanted to add a 5 day forecast but only saw the JSON format. (4.3" limits me to 7 for readability)

1 Like

@Dave_McLaughlin - I used openweathermap.org in my digital portal project. If you take a look at the WeatherProvider.cs class in the project below it uses JSON to process the “one call API”.

In case your interested I also built a WeatherIconProvider.cs that maps the icon code from openweathermap.org to the wi-regular.ttf font (Weather Icons - 222 font icons inspired by Font Awesome and designed for Bootstrap)). This way you can display an icon based on the open weather icon code.

digitalportal/src/Providers at main · bytewizer/digitalportal (github.com)

1 Like

Thanks Tom. I’ll be uploading my project to github when it is complete. I’ll be sure to make sure any source used has the original name included.

I have a dual 4.3" LCD SITcore for this project with one display showing time and the other the weather include 2 sensors via MQTT at my house. They communicate with each other over CAN. 2 Fez Portals could be used to run the software on but I only have wifi on one board.

Can’t wait to check it out. No worries at all. Please use it in any capacity that is helpful.