JSON Parsing - Counting inside an array, not the array itself

Is it possible to have a counter in a json_foreach loop after selection of an object?

The reason I ask is I want to check the component after selecting it and if it says Release Track Listing then count each.

Here's the code snippet:

outputto "TOTALTRACKS"
json_foreach "tracks"
json_select "component"
if "Release Track Listing"

## Here is where I would like to count inside the if statement.