I am trying to use Ionic Native HTTP but I can not send a array JSON. my code example:
let body = {“DivipolaModel”:}
headers = {token:“token”}
this.http.post(‘MyURL’,body,headers)
this JSON send:
{“DivipolaModel”:}
I am trying to use Ionic Native HTTP but I can not send a array JSON. my code example:
let body = {“DivipolaModel”:}
headers = {token:“token”}
this.http.post(‘MyURL’,body,headers)
this JSON send:
{“DivipolaModel”:}
What device are you testing this on? Are any errors thrown when you remote debug it?
I am testing in the emulator android studio with api 22.
I have not tried remote debug but I printed console.
This is the output on my console.
console.error: {“Message”:“Error.”}
console.error: headers 500
if the response code is 500 then it’s a problem ocurring in the server side.
To send a JSON you just have to make an object:
{
field1: value1,
field2: value2
}
you’re right, but To send a JSON I just have to make an array.
[
{
field1: value1,
field2: value2
},
{
field1: value1,
field2: value2
},
{
field1: value1,
field2: value2
},
etc
]
I am using typescript but send.
this example:
let body = {DivipolaModel:
[{
field1: value1,
field2: value2
},
{
field1: value1,
field2: value2
},
{
field1: value1,
field2: value2
}
] }