I am trying to get all keys from a json file in Python. How to get nested second level(x,y) and third level keys(a,b). For example, Keys: results,x,y,a,b
Code:
#open data
import json
with open('list.json') as f:
    my_dict = json.load(f)
#1
    #find keys
    for key in my_dict.keys():
         print("Keys : {}".format(key))
Json:
{
   "results":[
      {
         "x":5
      },
      {
         "x":5,
         "y":[
            1,
            2,
            3
         ]
      },
      {
         "x":5,
         "y":{
            "a":2,
            "b":67
         }
      }
   ]
}
Output:
Keys : results
 
     
    