(note to mods: this is not a duplicate of 'Fastest way to flatten / un-flatten nested JSON objects' the problem being posed is somewhat different)
I need to transform a string based hierarchal representation of data to a nested javascript object representation.
I figure lodash/collection/reduce
is could be useful. But what would be the best way to go about transforming / reducing a format like this;
{
"a/b/c": 1,
"a/b/d": 1,
"e/f/g/h": 1,
"e/f/g/i/j": 1
}
To something like this?
{
"a": {
"b": {
"c": 1,
"d": 1
}
},
"e": {
"f": {
"g": {
"h": 1,
"i": {
"j": 1
}
}
}
}
}