Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda