We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
下面是实体类
@DaTa @slf4j public class LiveWaterVO implements Serializable {
private String name;
private Long level1;
private Long level2;
private Long level3;
private Long wl;
@JsonIgnoreProperties(ignoreUnknown = true) private Long wlSixHoursAgo;
@JsonIgnoreProperties(ignoreUnknown = true) private Long wlThreeHoursAgo;
@JsonIgnoreProperties(ignoreUnknown = true) private Long wlOneHourAgo; } 原来的JSON:
[{"wl":0.01,"name":"西桥","level1":"9","level3":"0.7","level2":"1.4"}] 进行下面的转换后:
List liveWaterVOS = JSON.parseArray(jsonArrayStr,LiveWaterVO.class); System.out.println(liveWaterVOS); 结果显示如下: [LiveWaterVO(name=西桥, level1=9, level2=1, level3=0, wl=0, wlSixHoursAgo=null, wlThreeHoursAgo=null, wlOneHourAgo=null)]
ref alibaba/fastjson#4038
The text was updated successfully, but these errors were encountered:
这个有什么问题?
Sorry, something went wrong.
原始json串中 wl值为0.01 parseArray 输出变成0;level3值为0.7 parseArray 输出变成0;level2值为1.4 parseArray 输出变成1,,精度缺失了
对象类型就是Long,按这个输入,就应该是截断吧
确实是,Long是长整型,会截断,Double就不会丢失精度了
No branches or pull requests
下面是实体类
@DaTa
@slf4j
public class LiveWaterVO implements Serializable {
private String name;
private Long level1;
private Long level2;
private Long level3;
private Long wl;
@JsonIgnoreProperties(ignoreUnknown = true)
private Long wlSixHoursAgo;
@JsonIgnoreProperties(ignoreUnknown = true)
private Long wlThreeHoursAgo;
@JsonIgnoreProperties(ignoreUnknown = true)
private Long wlOneHourAgo;
}
原来的JSON:
[{"wl":0.01,"name":"西桥","level1":"9","level3":"0.7","level2":"1.4"}]
进行下面的转换后:
List liveWaterVOS = JSON.parseArray(jsonArrayStr,LiveWaterVO.class);
System.out.println(liveWaterVOS);
结果显示如下:
[LiveWaterVO(name=西桥, level1=9, level2=1, level3=0, wl=0, wlSixHoursAgo=null, wlThreeHoursAgo=null, wlOneHourAgo=null)]
ref alibaba/fastjson#4038
The text was updated successfully, but these errors were encountered: