SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.put(Long.class, ToStringSerializer.instance);
serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
//一定要设置SerializerFeature.PrettyFormat
String json = JSONObject
.toJSONString(o, serializeConfig,
SerializerFeature.PrettyFormat);
JSONObject.parse(json);
网友评论