I want to convert this web service string to JSONArray , but it seems to have a problem , although I've validated it.
[
{
"hireDate": null,
"homePhoneNumber": null,
"gender": null,
"city": null,
"mobileNumber": null,
"idNumber": 123,
"religion": null,
"leftOver": 1,
"annualVacations": 5,
"dob": null,
"name": null,
"rank": 0,
"id": 1,
"workingHours": [],
"email": "[email protected]",
"managers": [],
"alternativeMobileNumber": null,
"activated": true,
"username": "[email protected]"
},
{
"hireDate": null,
"homePhoneNumber": null,
"gender": null,
"city": null,
"mobileNumber": null,
"idNumber": 123,
"religion": null,
"leftOver": 1,
"annualVacations": 5,
"dob": null,
"name": null,
"rank": 0,
"id": 11,
"workingHours": [],
"email": "[email protected]",
"managers": [],
"alternativeMobileNumber": null,
"activated": true,
"username": "[email protected]"
}
]
My Code:
JSONArray js = new JSONArray(payload);
what should the format of payload be to create the JSONArray ?
Looking at the code it looks like it should work. Following sample worked for me (The JSON is taken as a string for testing).