DEV Community

almantas88
almantas88

Posted on

How to make JSON file to tree structure

I give front end data from back-end (Node.js and Firebase/firestore)
Data:
image

How does front-end (Vue.js) render this data as a tree, like this:

image

Top comments (3)

Collapse
 
aiosifelisl1 profile image
Andreas Iosifelis
Collapse
 
almantas88 profile image
almantas88

does this do the trick with children id references? Because back-end send data as a plain json object, but not a tree.

Collapse
 
aiosifelisl1 profile image
Andreas Iosifelis

From what I understand this module will display a json object in a UI format. If you want a specific structure, you're going to have to massage your data into that structure first and then feed it into the module.

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay