Multi-level JSON

With a variable called JSON set to that text, you can use the JSON path:

JSON.items[1].statistics.subscriberCount

to get the subscriberCount of the first item.

That is, the JSON variable contains a dictionary, and we look at the items array, the first element, which is a dictionary that includes the statistics entry, which itself is a dictionary that includes the subscriberCount.

Note that you can use JSON.items[0] to get the number of items if you want to iterate through all of them.

So, something like this:

image

Or to list all of them, any of these would work:

image

The first one using JSONVALUE(JSON.items[0]) to get the number of entries and iterates through them from 1 up to that.

The second one gets the keys indexing the JSONVALUE(JSON.items) array (which are just numbers from 1 up to the count of items), and iterates through them using that key.

And the last one iterates explicitly through the items, returning a JSON object {"key":KEY,"value":VALUE} for each items, where KEY is the index, and VALUE is the value, hence you can see JSONV.value.statistics.subscriberCount in that last one, that is where the value comes from.

9 Likes