I have a dict, that looks like this:
{ 'foo': { 'opt1': 1, 'opt2': 2, }, 'foo/bar': { 'opt3': 3, 'opt4': 4, }, 'foo/bar/baz': { 'opt5': 5, 'opt6': 6, } }
And I need to get it to look like:
{ 'foo': { 'opt1': 1, 'opt2': 2, 'bar': { 'opt3': 3, 'opt4': 4, 'baz': { 'opt5': 5, 'opt6': 6, } } } }
I should point out that there can and will be multiple top-level keys (‘foo’ in this case). I could probably throw something together to get what i need, but I was hoping that there is a solution that’s more efficient.
Like this: