rowdata= {anno:"1235",cat:19999.576315}
使用JSONObject.formObject时,rowdata= {anno:"1235",cat:19999.576},
使用JsonNode
JsonNode node = new ObjectMapper().readTree(rowdata.toString());
String cat = node.get("cat").toString().repalceAll("\"","").trim();
cat = 19999.576315
在处理JSON数据时,注意到使用JSONObject.fromObject方法转换rowdata时,数值cat丢失了精度,变成19999.576。而通过JsonNode解析并获取cat字段后,数值恢复为19999.576315。这展示了JSON序列化与反序列化过程中精度可能的变化。
2185

被折叠的 条评论
为什么被折叠?



