Bug? JSON - Parse Error - Infinite number

PhiloSophical

Member
Licensed User
Longtime User
I was parsing this JSON and puzzled for a while over an exception that complained of an "infinite number"
org.json.JSONException: Forbidden numeric value: Infinity
[
{
"Description": "John",
"object-Id": "656B5023-DBC9-B831-FFA9-E0913160400"
}
]


This when

B4X:
Dim JP As JSONParser
Dim s As String
s=$"[
{
        "Description": "John",
        "object-Id": "656B5023-DBC9-B831-FFA9-E0913160400"
}
]"$
Dim l As List
Dim m As Map
JP.initialize(s)
l=JP.nextarray
JP.initialize(l.get(0))
m=JP.NextObject

I've come up with an answer. The "-E" is being interpreted as an exponential operator for some reason.

Would appreciate confirmation from @Erel and look forward to a bug fix if this is confirmed.

Thanks
 

PhiloSophical

Member
Licensed User
Longtime User
Thank you Erel - I didn't realise that the JSON parser was part of the Android OS.

I can confirm now that the above code also works on Android 7.0 also but fails on 4.2.2
 
Top