I have a slightly more complex than posted function which loops through JSON data. But the problem should be apparent here.
The for loop
only looks through the very first row of the JSON data, which does not have the parameter I'm seeking, and so it stops immediately after parsing the very first row of the JSON data. I would like for it to continue looping through each row in the data until it finds the value_id
I pass in, which does exist the JSON data some many rows down.
Is there some simple modification I'm missing here that can make this possible?
def get_values(value_id):
identifier = None
data = api_grabber.get_value_data()
for row in data["data"]:
if row["department"]["segment"]["data"]["id"] == value_id
break
if identifier is None:
return