Handling dictionaries using the Get Dictionary Value action in Shortcuts
To get the value for a particular key in a dictionary, you can use the Get Dictionary Value action and specify the name of the key. To get the daily forecast, add the Get Dictionary Value action and set it to daily
.
If you want the weather summary, you can use the dot notation daily.summary
, as shown in the screenshot below.
The detailed forecast for each day is stored in daily
as a dictionary called data
, as shown in the screenshot below. Using dot notation, you can access data nested multiple levels deep in a dictionary.
Notice that the data
dictionary is actually a list of dictionaries, represented at the start by the left bracket ([
) in JSON. In the above image, a list of eight items (identified by the page dots above search field), is output from the Get Dictionary Value action. This represents the forecast data for each of the days requested from the API, which returns today and the next seven days to become a list of eight dictionaries of data.
For information on working with multiple items in a dictionary, see Handling lists using the Repeat with Each action in Shortcuts.