使用FastJson序列化并反序列化之后存入MongoDB,Doule类型变成了String

 // 关键代码
 int disableDecimalFeature = JSON.DEFAULT_PARSER_FEATURE & ~Feature.UseBigDecimal.getMask();
 String str = JSON.toJSON(testEntity).toString();
 //JSONObject JB = JSON.parseObject(str);
 JSONObject JB = JSON.parseObject(str,JSONObject.class,disableDecimalFeature);

原文地址:https://blog.csdn.net/Jeremykim1026/article/details/102784658

发布了24 篇原创文章 · 获赞 14 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/biubiu2it/article/details/103521959