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

183
Views
create csv from objects with different keys

I have an array of objects. Some of their keys are identical but some of them exist only in one of the object:

const data =[
{id:123, name:foo, number:25},
{id:124, name:boo, number:35, blue:8},
{id:125, name:soo, number:40, red:10}
]

I want to convert my data into a CSV, so that the headers will include all keys. if key doesn't exists in the object its value should be null , see example below:

id name number blue red
123 foo 25 null null
124 boo 35 8 null
125 soo 40 null 10

I was able to achieve this with few loops , but the code is ugly :)

Thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Check if this solution applies to your problem.

Generate a csv file from a javascript array of objects

If you have any doubts in the process, just reply here. I'll try to help

about 4 years ago · Juan Pablo Isaza Report
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!