Giving data organized in JSON format (code example bellow) how can we get the path of keys and sub-keys associated with a given value?
i.e.
Giving an input "23314" we need to return a list with: Fanerozoico, Cenozoico, Quaternario, Pleistocenico, Superior.
Since data is a json file, using python and json lib we had decoded it:
import json
def decode_crono(crono_file):
    with open(crono_file) as json_file:
        data = json.load(json_file)
Now on we do not know how to treat it in a way to get what we need. We can access keys like this:
k = data["Fanerozoico"]["Cenozoico"]["Quaternario "]["Pleistocenico "].keys()
or values like this:
v= data["Fanerozoico"]["Cenozoico"]["Quaternario "]["Pleistocenico "]["Superior"].values()
but this is still far from what we need.
{
"Fanerozoico": {
    "id": "20000",
    "Cenozoico": {
        "id": "23000",
        "Quaternario": {
            "id": "23300",
            "Pleistocenico": {
                "id": "23310",
                "Superior": {
                    "id": "23314"
                },
                "Medio": {
                    "id": "23313"
                },
                "Calabriano": {
                    "id": "23312"
                },
                "Gelasiano": {
                    "id": "23311"
                }
            }
        }
    }
}
}
 
     
     
    