Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Convert tabular json data to d3 hierarchal data for treemap

I have a small dataset in JSON file which I want to convert into hierarchal data format to create a tree map. This is part of my dataset:

{
"root": [
{"Folder": "Videos", "filename": "file1.mp4", "size": 77},
{"Folder": "Videos", "filename": "file2.mp4", "size": 10},
{"Folder": "Misc", "filename": "file11.ppt", "size": 1},
{"Folder": "Misc", "filename": "file12.ppt", "size": 3}
]
}

This is the output I am looking for:

{
"name": "root",
 "children": [
  { "name": "Videos",
 "children": [
  { "name": "file1.mp4" , "size" : 77},
  { "name": "file2.mp4" , "size" : 10}
]
},
{ "name": "Misc",
 "children": [
  { "name": "file11.ppt" , "size" : 1},
  { "name": "file12.ppt" , "size" : 3}
]
}
]
}

I know I have to group it somehow but I can't figure out how. Any idea how should I proceed with this?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!