Given the JSON structure below, annotate the nested values accordingly.
{
'0': '0',
'1': '1',
'2-0': '2-0',
'2-1': '2-1',
'3-0': '3-0',
'3-1-0': '3-1-0',
'3-1-1': '3-1-1',
'3-2': '3-2'
}
Now, I want to transform this into a nested array as shown below:
[
'0',
'1',
[
'2-0',
'2-1'
],
[
'3-0',
[
'3-1-0',
'3-1-1'
],
'3-2',
]
Any suggestions on how to achieve this transformation?
I prefer using TypeScript (or JavaScript), but welcome solutions in other languages too.