I am having a code like:
myvar0 = jsonfromapi['people']['young']['data'][0][information][isreal]
myvar1 = jsonfromapi['people']['young']['data'][1][information][isreal]
myvar2 = jsonfromapi['people']['young']['data'][2][information][isreal]
print(myvar0)
print(myvar1)
print(myvar2)
Output:
true
false
false
Now the JSON includes a lot of 'people'. But every time only one of them is true real.
My goal is to only print the data from the one that is true. In my example above 0. Unfortunately the true one changes. Sometimes it's 0 who is true, sometimes 1 and sometimes 2.
How can I only get the true one and get more data from this true one? For example, when 2 is true: myvar2 = jsonfromapi['people']['young']['data'][2][information][name] but without the names of 1 and 0.
EDIT: Every time only one person is real / true.