I am using the org.json.XML library to parse XML in JSON. http://www.json.org/javadoc/org/json/XML.html
My XML document has an ID field that is randomly generated using [0-9] [az]. It is intended for String. Everything works fine until this bad ID 123456789e1234 appears, which is the scientific note of the number. Here is a snippet of test code:
public class XmlToJsonTest {
public static String testXML = "<MyXML><ID>123456789e1234</ID></MyXML>";
@Test
public void testXMLtoJSON() throws JSONException {
JSONObject testJsonObject = XML.toJSONObject(testXML);
}
}
Here's the exception:
org.json.JSONException: JSON does not allow non-finite numbers.
XML lib toJson() String Integer, Long Double, , String. String 123456789e1234 . , lib , double Double.isInfinite(), JSON, , , 123456789e1234 , .
? - java-, XML JSON ?