Convert specific items in a dictionary to lists
Given a dictionary D , and a list of nodes N, I need to replace all existing nodes in the dictionary which are single value to list of values containing the single one.
For example:
D= {foo:"bar",bar:"baz"}, N={"foo"} => {foo:{"bar"} /*converted*/,bar:"baz"/*no change*/}
D={bar:"baz",foo:{"multi","items"},nested:{foo:"bar"}}, N={"foo","bar"} => {bar:{"baz"} /*converted*/,foo:{"multi","items"}/*no change*/ ,nested:{foo:{"bar"} /*converted*/}
The use case is to support conversion from XML where certain nodes should be arrays, however when converting from XML to JSON and there is
a single item under those nodes, we need it to be array and not a single object.
