I need to merge multiple dictionaries, here’s what I have for instance: With A B C and D being leaves of the tree, like {“info1″:”value”, “info2″:”value2”} There is an unknown level(depth) of dictionaries, it could be {2:{“c”:{“z”:{“y”:{C}}}}} In my case it represents a directory/files structure with nodes being docs and leaves being files. I want to merge them to obtain: