A method that makes a lot of sense to me is to have the list interpreted as json, and thus each node consists of a key value pair.
Example:
- Fruit table
- apple
- price:20
- health:10
- toblerone
- price:100
- health:2
- danger:5
- apple
In this case, the nodes (Apple) become the table index and the keys are column names. Values are, well, values. If there is no key-value pair for a node, it would default to null. It’s a similar approach to many other json-to-table implementations.
One clear benefit of this over the OP post is that you can quickly input new data without having to worry about the parent storing column metadata. If I want to add “flavour” as a new column, all I have to do is update a single node and it becomes a column.
Below is a link that also serves to illustrate how to tackle the issue of multi-nesting (tl;dr only look at 1 level of depth).