My data structure is as follows:
{ projects: [
{ revisions: [
{ files: [] },
],
}
],
user: {}
}
To view the jsFiddle, click here: http://jsfiddle.net/winduptoy/EXdDy/
I am attempting to recursively generate a JSON hierarchy depicting an object's parents and their id
s. Please check your console. Take a look at projects[0].revisions[0]._idTree
, where the projects._id
and revisions
are displayed as a child of projects
, just as expected. Now observe
projects[0].revisions[0].files[0]._idTree
, which shows projects.files
as a sibling of projects.revisions
, when files
should actually be a child of projects.revisions
. How can I resolve this issue?