I've few dictionaries as follows:
{"item1": {"item2": "300"}}
{"item1": {"item3": {"item4": "400"}}}
{"item1": {"item3": {"item6": "16"}}}
{"item1": {"item7": "aaa"}}
{"item1": {"item8": "bbb"}}
{"item1": {"item9": {"item10" : "2.2"}}}
{"item1": {"item9": {"item11" : "xxx"}}}
I want to merge these dictionaries as follows
{
"item1": {
"item2": "300",
"item3": {
"item4": "400",
"item6": "16"
},
"item7": "aaa",
"item8": "bbb",
"item9": {
"item10": "2.2",
"item11": "xxx"
}
}
}
item1 is the first key in all dictionaries whereas the nested keys will vary. If there is same nested dictionary within a dictionary in two dictionaries the keys has to be merged (eg: item3 in dictionary 1 and 2). How can i achieve this?