Parsing JSON Weather Observations


I would love some help with parsing JSON feeds of webpages. While I have spent the past year or so becoming comfortable with Shortcuts, JSON is something new. I am starting to explore dictionaries (thanks to MacSparky’s Shortcuts Field Guide)

I have a requirement for work to check daily the previous days weather observations and see if the temperature was recorded above 35ºC. I could scroll through lines of weather observations, however was hoping Shortcuts could do that for me.

The JSON feed is -

I am interesting at viewing “local_date_time” for all values when corresponding “air_temp” is greater than 35ºC.

Any help would be appreciated. Automating life’s (work’s) chores has been fun, but this is pushing me.

Many Thanks

See if this example helps. This should get you started. Let me know if you have questions — jay

This should do it:

You can add a “Combine text with new lines” at the end if you want them all to be in one document.

Note that I searched for temperatures greater than 29 for testing, because there are currently none observed over 35. You can change that in the “if dictionary value is greater than 29” block.

The “format date” block didn’t understand the way the date is formatted in the source data, so I used some quick and dirty regex (search for 4 digits, then 2 digits, 2 digits, 2 digits, 2 digits, 2 digits) to format it before passing it into “format date”.

Hi. Many thanks to both of you for the responses and assistance. It was all I needed to get started. Thanks!

1 Like