I have a dictionary object in python, I will give two parameters to a method which is some key name key and the json object, i want to receive an output that will have the absolute path of the key.
Example json object and the key name is "year"
{
"name": "John",
"age": 30,
"cars": {
"car1": {
"name": "CD300",
"make": {
"company": "Benz",
"year": "2019"
}
}
}
}
my function will be something like below
def get_abs_path(json, key):
print(res)
expected output res = cars.car1.make.company