Here's a function that takes a JSON object and converts it to a n-ary tree data structure:
index.tsx434 chars23 lines
Assuming you have a JSON object like this:
index.tsx233 chars20 lines
You can convert it to a n-ary tree like this:
index.tsx54 chars3 lines
This would output:
index.tsx239 chars20 lines
gistlibby LogSnag