I got a json response as
{
"tasks": null,
"projects": null
}
how to check if the array has null values and handle the case??
Thanks:)
I got a json response as
{
"tasks": null,
"projects": null
}
how to check if the array has null values and handle the case??
Thanks:)
Try This
=============
try {
String url;
JSONObject JsonData = new JSONObject("YOUR FULL JSONSTRING");
JSONArray webData = JsonData.getJSONArray("YOUR ROOT NAME OF YOUR JSON RESPONSE");
for(int i=0;i<webData.length();i++)
{
JSONObject TeampObj = webData.getJSONObject(i);
if(TeampObj.getString("tasks").trim().length()>0)
{
//store data in arrylist or string array
}
if(TeampObj.getString("projects").trim().length()>0)
{
//store data in arrylist or string array
}
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}