JSON does not allow non-finite numbers
in
Core Library Questions
•
6 months ago
If I am running the following java code using json 20080701 then I have no problem:
String xmlString = "<Envelope><Body><Id>10e6847</Id></Body></Envelope>";
JSONObject json = XML.toJSONObject(xmlString);
but if I am using json 20090211 then I get:
org.json.JSONException: JSON does not allow non-finite numbers.
at org.json.JSONObject.testValidity(JSONObject.java:1261)
at org.json.JSONObject.accumulate(JSONObject.java:420)
at org.json.XML.parse(XML.java:257)
at org.json.XML.parse(XML.java:263)
at org.json.XML.parse(XML.java:263)
at org.json.XML.parse(XML.java:263)
at org.json.XML.parse(XML.java:263)
at org.json.XML.toJSONObject(XML.java:302)
etc...
How do I make it no longer choke on the "10e6847"? How can I tell json to go back to treating this ID as a simple string rather then thinking it is a number?
String xmlString = "<Envelope><Body><Id>10e6847</Id></Body></Envelope>";
JSONObject json = XML.toJSONObject(xmlString);
but if I am using json 20090211 then I get:
org.json.JSONException: JSON does not allow non-finite numbers.
at org.json.JSONObject.testValidity(JSONObject.java:1261)
at org.json.JSONObject.accumulate(JSONObject.java:420)
at org.json.XML.parse(XML.java:257)
at org.json.XML.parse(XML.java:263)
at org.json.XML.parse(XML.java:263)
at org.json.XML.parse(XML.java:263)
at org.json.XML.parse(XML.java:263)
at org.json.XML.toJSONObject(XML.java:302)
etc...
How do I make it no longer choke on the "10e6847"? How can I tell json to go back to treating this ID as a simple string rather then thinking it is a number?
1