I have a method that I am using to send a list of values to my backend. The required JSON format is:
{
value: [xyz]
}
Currently, I am only sending the "xyz" part to the backend as a single value, but I need to send it in the specified format.
When I check the payload sent to the backend in the network console, it shows something like this: "xyz".
This is the function I am currently using to send these values:
setValueForTest() {
this.personArray = this.form.controls.selectBox.value;
this.personArraySave = []
this.personArray.forEach((id) => {
this.personArraySave.push(id)
this.api.setValueForPerson({
body: id
).subscribe(response => {
console.log(response)
});
}
});
}
The attributes "body" and "personArraySave" are of type Person, which has an attribute of "id: Array."