Home > Back-end >  Fastjson get doubleValue () type conversion error, solving
Fastjson get doubleValue () type conversion error, solving

Time:10-18

Com. Alibaba. Fastjson. JSONException: can not cast to double, value: 1640.00
At com. Alibaba. Fastjson. Util. TypeUtils. CastToDouble (TypeUtils. Java: 400)
At com. Alibaba. Fastjson. JSONObject. GetDoubleValue (JSONObject. Java: 298)

Data is of type double, but out type conversion error,
Had to turn the string first, then turn to double

CodePudding user response:

Source code is simple than you think, especially the patch type conversion, I suggest you see
Com. Alibaba. Fastjson. Util. TypeUtils. CastToDouble (TypeUtils. Java: 400)
This piece of code, or at least can see why will quote this wrong

CodePudding user response:

Class use bigdecimal recommended amount