fastjson
# java code
JSON.toJSONString(demoBean,
SerializerFeature.PrettyFormat,
SerializerFeature.WriteNonStringKeyAsString,
SerializerFeature.WriteNullNumberAsZero,
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteNullStringAsEmpty,
SerializerFeature.WriteNullBooleanAsFalse);
// output
{
"department":"",
"isDelete":false,
"list":[],
"map":{"1":"ddd"},
"name":""
}
网友评论