Deep Nested Objects
9thstudio opened this issue · comments
9thstudio commented
Hi
I have deep nested objects but looks unflatten just deep down to 3 levels. Let me know if I am missing something
const mainObj = {
sub1.sub2': 'abc',
sub1.sub2.sub3.sub4': 'xyz'
}
test = unflatten(mainObj);
console.log(test);
results in
mainObj: {
sub1: {
sub2: 'abc',
sub3: [Object]
}
Can't get value down to sub4 or below. It always shows [Object]. Is there a limit?
narkiss-ibex commented
I have the same issue. did you manage to solve it by any chance?
Jon Koops commented
The problem is with your input. There are duplicate entries for sub1.sub2
, one of them being the value 'abc'
and the other is sub1.sub2.sub3
. Since sub1.sub2
is already a string value it cannot also be an object.