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

166
Views
json2csv for nested objects

I'm trying to convert my record into csv using json2csv in nodejs, this is what the record looks like:

  faqs: Record<string, any>;
  @Prop({
    type: raw({
      question: { type: String },
      answerName: { type: String },
      answer: { type: String },
      status: { type: Boolean },
      answers: {
        type: raw({
          channels: { type: String },
          answerParts: {
            type: raw({
              type: { type: String },
              data: { type: raw({
                text: {type: String}
              }), required: false },
            }),
          },
        }),
      },
    }),
    required: false,
  })

And this is what I have so far, the problem is that the field 'answers' is not working because it is a nested field, how can I solve this?

const fields = ['question', 'answer', 'answerName','answers'];
    const parser = new Parser({
      fields,
      unwind: ['question', 'answer', 'answerName','answers'],
      delimiter: ';',
      withBOM: true,
    });'

Moreover, I also need to transform the field 'answer' so that the second repeated answer has a # in the start, is that possible with this library, maybe with "transforms"?

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!