objectpath json query to get array values in python objectpath json query to get array values in python json json

objectpath json query to get array values in python


sections is a generator object. To get the first item from it you can use next() function:

sections = Tree(db).execute('$.books[@.name is "Mark"].sections')print(sections) # will show that it's a generatorfor section in next(sections):    print(section)    print("----\n")

This first item will be the list with individual sections. Now you can iterate over each section using for loop.