I don't know if I am able to express myself in the title,
Example dict:
dict_x = {"key1": "value1", "key2": [{"key3": "value3"}, {"key4": [{"key5": "value5"}, {"key6":
"value6"}]}]}
Edit: think that you have many nested dicts like this. You have to loop through.
Edit2 : We need a recursive approach for hugely nested dicts
what do I want to get as output:
{"key1": "value1", "key2": [{"key3": "value3"}, {"key5": "value5"}, {"key6": "value6"}]}
so removing key4 but retaining the values and pass it to upper key as values.
I searched through stackoverflow but only solutions that are given is to flatten dict or removing keys with values they hold. I want to remove a key but I don't want to lose its values.