I am getting JSON string from website. I have data which looks like this (JSON Array)
myconf= {URL:[blah,blah]}
but some times this data c
Quite a few ways.
This one is less recommended if you are concerned with system resource issues / misuse of using Java exceptions to determine an array or object.
try{
// codes to get JSON object
} catch (JSONException e){
// codes to get JSON array
}
Or
This is recommended.
if (json instanceof Array) {
// get JSON array
} else {
// get JSON object
}