samedi 28 février 2015

How to have the same order in a JSON Array as a JSON response?



I am receiving a JSON response such as



{
"status": "success",
"0": {
"fname": "john",
"lname":"doe"
},
"1": {
"fname":"jane",
"lname":"doe"
}
}


When I get this JSONObject and try to put it into a JSON Array such that element 0 is status:succes, element 1 is fname: "john", lname: "doe" .. etc. The result is mixed up. The array is not in the same order as the JSON Response. How can I parse the JSON Response and each element as a JSON Object in the same order?




Aucun commentaire:

Enregistrer un commentaire