Closed
Description
If you have a string in your XML, that also happens to be a valid number in scientific notation, it will be transformed into a java representation of that number when XML is transformed into JSONObject:
XML.toJSONObject("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
"<str1>045e5000</str1>\n" +
"<str2>45e5000</str2>\n" +
"<str3>045e50</str3>\n" +
"<str4>45e5</str4>");
will return
{"str1":"045e5000","str4":4500000,"str3":4.5E51,"str2":"45e5000"}
I understand that vanilla XML doesn't have a way to define types, but I still think this is a very unpredictable behavior. I am not sure how to solve it. Possibly, do not convert e notations and leave them as strings?
Metadata
Metadata
Assignees
Labels
No labels