Skip to content Skip to sidebar Skip to footer

Check And Read Inner Json Array Which Is In Main Json Array In Android?

I want to check and read a JSON array which is in main JSON array. How can I check if main jsonarray has a 'submenu' array that I want to read? I implemented my code here but it gi

Solution 1:

How can I check if main jsonarray has a "submenu" array that I want to read?

Here you go:

JsonArray jarr = jarray.getJSONObject(i).optJSONArray(ClassVariable.SUBMENU.SUBMENU);

if(jarr.length()>0 && jarr!=null)
{
    SUBMENU Jarray is present
}
else
{
    SUBMENU Jarray is Not present
}

Post a Comment for "Check And Read Inner Json Array Which Is In Main Json Array In Android?"