fastjson 处理long转string

2020-08-06  本文已影响0人  dingking

    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);
上一篇下一篇

猜你喜欢

热点阅读