My attempt to rewrite the array at the level of the item I wanted to introduced a subtle flaw. I made it clear what data structure I wanted:
[
'note',
[
'shopping',
[
'item',
'bread'
],
[
'item',
'butter'
],
[
'item',
'beans'
]
]
];
but then the code above introduces an extra level of array referencing that is not acceptable:
[
'note',
[
'shopping',
[
[
'item',
'bread'
],
[
'item',
'butter'
],
[
'item',
'beans'
]
]
]
];
it looks like I will have to write the child list at the level of the parent instead of rewriting at the level of the child.
|