String转json方式
//这种方式会自动剔除掉为null数据 String stg = JSON.toJSONString(list) //后面加上SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue 就不会过滤空值字段了 String stg = JSON.toJSONString(list,SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)