Hi,

Just sending the email to check if someone has come across json-smart
library converting long floating point numbers in a  json payload to
scientific notation? e.g: the following code snippet converts a number like
52707625.39 to 5.27062539E7 when sending the payload through the parser.
Does anyone know how to avoid this conversion?

import net.minidev.json.parser.JSONParser;

JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE);
Object objJsonContent = parser.parse(jsonPayload);

I tried the same in the gson parser as shown below and it doesn't happen.

import com.google.gson.JsonParser;

JsonParser parser = new JsonParser();
JsonElement objJsonContent = parser.parse(jsonPayload);

I have a long code (a class mediator) which is using json-smart and have
the said problem. If no other option available it has to be changed to use
gson instead.

Appreciate your help.

regards,

-- 
Shazni Nazeer

Mob : +94 777737331
LinkedIn : http://lk.linkedin.com/in/shazninazeer

Blogs :

https://medium.com/@mshazninazeer
http://shazninazeer.blogspot.com

<http://wso2.com/signature>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to