How to handle null response for json object
- by user1494754
I get a JSON response as
{
"edges": [],
"nodes": []
}
how to check if the objects has null values and handle the case??
JSONObject jobj = new JSONObject(line);
JSONArray jArray = jobj.getJSONArray("edges");
if(jArray.length()!=0)
{
for(int i=0;i<jArray.length();i++){
JSONObject json_data = jArray.getJSONObject(i);
x.add((float) json_data.getInt("x"));
y.add((float) json_data.getInt("y"));
end
This retrurns me : org.json.JSONException: end of input at character 0 of