I have a json object as I have shown in two cases :-
Case 1 :
{
OWNER_ID : 145
}
Case 2 :
{
OWNER_ID : null
}
Now in order to parse the data I am using the following statement :
int note_owner_id = jsonObject.getInt("OWNER_ID");
I am aware of the fact that in java we need to use wrapper class in order to extract a NULL integer and the code should be written like this:-
Integer note_owner_id = jsonObject.getInt("OWNER_ID");
But still I am not able to parse the data successfully. Can any one help me? How to parse the int value in general so that it won't show any Exception?
Thank you in advance.