I need to construct API body for using in javascript fetch. The length of array is twenty or so and I need a loop.
I have an array of objects:
[
{
name:"x",lname:"y"
},
{
name:"x2",lname:"y2"
},
]
and this what I want to achieve:
{
"0":{
"name":"x",
"lname":"y"
},
"1":{
"name":"x2",
"lname":"y2"
},
}
This is raw in postman body:
Any guide and help would be appreciated.