- 格式化JSON
public static void main(String[] args) {
String text = "{\"hello\":{\"test\":\"val\"}}";
String pretty = JSON.toJSONString(JSON.parseObject(text), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteDateUseDateFormat);
System.out.println(pretty);
}
{
"hello":{
"test":"val"
}
}