Commit 3fcc02c9 authored by tangwei's avatar tangwei

修改long精度丢失问题

parent f374c710
package com.yeejoin.amos.patrol.core.common.request;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
/**
* @description:
* @author: tw
* @createDate: 2023/4/13
*/
public class ToJson {
public static Object tojson(Object obj) {
Object ob=null;
if(obj!=null){
SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.put(Long.class, ToStringSerializer.instance);
serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
String json = JSONObject
.toJSONString(obj, serializeConfig,
SerializerFeature.PrettyFormat);
ob=JSONObject.parse(json);
}
return ob;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment