[Solved] How to read a single object from a json file containing multiple objects using python? [closed]


Try adding adding an if parameter to check if its the desired item that your looking for, then just record all of its information.

import json

with open('elements.json') as f:
   data = json.load(f)
choice = input("Choose element: ")

for element in data['Elements']:
   if element['name'] == choice:
       for x, y in element.items():
         print(x.title() + "-> " + y)
   

solved How to read a single object from a json file containing multiple objects using python? [closed]