JSON parsing accuracy loss problems (net.sf.json)

Scene problem occurs:

json type data transmission over a BigDecimal] [545169.8113 through JSONObject.fromObjectto convert it to an object, the object data stored in the data after conversion has become lost] [545169.8 some accuracy is lost.

JAR used by packages: net.sf.json


Issue Tracking

Trace the root of the problem, call in the resolution process has been carried out and there
-w1113
will eventually be a nextValue splicing [545169.8113], this is the right time.
-w1392
-w1186

This will be the last incoming NumberUtils.createNumber method, it will be a loss of precision Float parsed
-w992

My solution is to change a package [Ali] com.alibaba.fastjson, personally feel that there are other solutions should be configured by jsonConfig. Wait for further research.

Guess you like

Origin www.cnblogs.com/Mr-GG/p/json-jie-xi-jing-du-diu-shi-wen-ti-netsfjson.html