How to ignore key in nested JSON (because it has variable name)

323 views Asked by At

I have following JSON, where element "Key_with_variable_name" has variable name compared to other keys:

{
    "Key1": {
        "Key11": {
            "Key111": "Value111",
            "Key112": "Value112",
            "Key113": "Value113",
            "Key114": {
                "Key1141": {
                    "Key_with_variable_name": {
                        "Key114111": {
                            "Key1141111": "Value1141111",
                            "Key1141112": "Value1141112",
                            "Key1141113": "Value1141113"
                        }
                    }
                }
            }
        }
    }
}

How can I access Key114111 (get its name) which is "under" Key_with_variable_name and then access nested Key1141111 and it's value Value1141111? And can I get value of Key_with_variable_name?

I used json_message = json.loads(jsonObject) and worked on JSON as nested dictionary, but struggled to get down deep past "Key_with_variable_name"

Or maybe it can be done easier working on JSON not on dictionary?

0

There are 0 answers