Check if a subkey in a JSON file exists
I want to create a condition to check if a subkey in a JSON file exists: with open(‘C:/files/response.json’) as json_file: data = json.load(json_file) if ‘XMLRESPONSE’ in data and data[‘XMLRESPONSE’][‘ITEM’]: print("key exist in JSON data") else: print("Key doesn’t exist in JSON data") input ("Press any key") But that doesn’t work. I want to do 2 things:… Read More Check if a subkey in a JSON file exists