I want a request from postman in particular format but I don't know how to do it.
So, I want to send data from postman to my local API in array of object. That object contains textual information and may one file and I have multiple objects like that. for e.g. :
[{
id: 1,
question: How are you ?,
answer: I am fine.
},
{
id : 2,
question: "upload your document",
answer: [file]
}
]
This is how my request looks on postman,
And this is how i am getting it in backend
{ additonalQuestion:
[ '12',
'Upload your document',
'file',
'13',
'How old are you ?',
'text',
'16' ] }
I am using formidable node package to read it. and following is the code
const formidable = require('formidable');
const form = formidable({ multiples: true });
await form.parse(req, (err, fields, files) => {
console.log('fields: ', fields);
});
To summarise my question , How to can i make a request from postman where i can get request like
[{
id: 1,
question: How are you ?,
answer: I am fine.
},
{
id : 2,
question: "upload your document",
answer: [file]
}
]
In backend.
Thank you for your time :)
