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"?