对JSON类型的处理

对JSON类型的处理,第1张

对JSON类型的处理

1.JSON对象转java对象
(如果需要将某个类转成Json串的话,那么必须要求其属性为public,或者提供public的get()方法。注意:必须要是public 的get()方法。)
FundReportQueryEntity fundReportQueryEntity=
(FundReportQueryEntity)JSONObject.toBean(datas, undReportQueryEntity.class);

2.TA系统中java生成UUID
fundReportQueryEntity.setId(UUIDGenerator.getUUID());

3:在把对象转JSONObject时 应该使用: google的Gson反序列化,这样可以避免数值类型的精度丢失
JSonObject jsonObject = new Gson().fromJson(backVal,JSONObject.class);

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/4690963.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-07
下一篇 2022-11-07

发表评论

登录后才能评论

评论列表(0条)

保存