You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, org.json provides an isNull method. Since there are no docs for the NetworkParser, I ended up looking in the source, ending up with nothing.
That leaves me with the question:
How to distinguish between "" and null using the NetworkParser library when using getString?
Edit:
I am currently using this workaround:
Stringnullable = (String)obj.get("foo");
However, considering this JSON document: {"foo": 5 }, the cast to String will fail because get() returns the int 5 (which seems good to me), whereas getString() returns "5" in this case.
The text was updated successfully, but these errors were encountered:
Consider this JSON document:
The
foo
property is either a string or null.When I try the following:
I expected
foo
to benull
, not""
.How to distinguish
"foo": null
from"foo": ""
?I looked up how org.json handles this case. As stated here, it behaves similar:
http://stackoverflow.com/questions/13118146
However, org.json provides an
isNull
method. Since there are no docs for the NetworkParser, I ended up looking in the source, ending up with nothing.That leaves me with the question:
How to distinguish between
""
andnull
using the NetworkParser library when using getString?Edit:
I am currently using this workaround:
However, considering this JSON document:
{"foo": 5 }
, the cast to String will fail because get() returns the int 5 (which seems good to me), whereas getString() returns"5"
in this case.The text was updated successfully, but these errors were encountered: