I am working on generating the following structure:
[
{
"id":"1",
},
{
"id":"3",
},
{
"id":"5",
},
{
"id":"6",
},
{
"id":"9",
},
]
Person = {
"id" : Id
};
PersonArray.push(Person);
tempPersonJson['PersonList'] = JSON.stringify(PersonArray);
This is what I am getting as output:
List = "[{\"id\":\"12\"},{\"id\":\"10\"},{\"id\":\"9\"},{\"id\":\"8\"},{\"id\":\"7\"},{\"id\":\"6\"},{\"id\":\"5\"},{\"id\":\"4\"},{\"id\":\"3\"},{\"id\":\"2\"},{\"id\":\"1\"},{\"id\":\"12\"},{\"id\":\"10\"},{\"id\":\"9\"},{\"id\":\"8\"},{\"id\":\"7\"},{\"id\":\"6\"},{\"id\":\"5\"},{\"id\":\"4\"},{\"id\":\"3\"},{\"id\":\"2\"},{\"id\":\"1\"}]";
The API raises an issue with this:
Call Body Expected body: Content-Type is application/json but body is not a parseable JSONParse error on line 21: ...value": true },] ---------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got ']' Watchout for malformed JSON. Expected data media type ('null') does not match real media type ('application/json').
Update, JSON sent to server:
[{"id":"12"},{"id":"10"},{"id":"9"},{"id":"8"},{"id":"7"},{"id":"6"},{"id":"5"},{"id":"4"},{"id":"3"},{"id":"2"},{"id":"1"}]