1、JSON.toJSNString的API
1.1 static String toJSONString(Object object, SerializeFilter[] filters, SerializerFeature... features); 1.2 static String toJSONString(Object object, boolean prettyFormat) ; 1.3 static String toJSONString(Object object); 1.4 static String toJSONString(Object object, SerializeFilter filter0, SerializeFilter filter1, SerializeFilter... filters); 1.5 static String toJSONString(Object object, SerializerFeature... features); 1.6 static String toJSONString(Object object, SerializeConfig config, SerializerFeature... features); 1.7 static String toJSONString(Object object, SerializeConfig config, SerializeFilter filter, SerializerFeature... features); 1.8 static String toJSONString(Object object, SerializeFilter filter, SerializerFeature... features); 1.9 static String toJSONString(Object object, int defaultFeatures, SerializerFeature... features)
2、参数定义
SerializerFeature... features:
QuoteFieldNames-输出key时是否使用双引号,默认为true
UseSingleQuotes,
WriteMapNullValue-是否输出值为null的字段,默认为false
WriteEnumUsingToString,
WriteEnumUsingName,
UseISO8601DateFormat,
WriteNullListAsEmpty,
WriteNullStringAsEmpty,
WriteNullNumberAsZero,
WriteNullBooleanAsFalse,
SkipTransientField,
SortField,
WriteTabAsSpecial,
PrettyFormat,
WriteClassName,
DisableCircularReferenceDetect,
WriteSlashAsSpecial,
BrowserCompatible,
WriteDateUseDateFormat,
NotWriteRootClassName,
DisableCheckSpecialChar,
BeanToArray,
WriteNonStringKeyAsString,
NotWriteDefaultValue,
BrowserSecure,
IgnoreNonFieldGetter,
WriteNonStringValueAsString,
IgnoreErrorGetter,
WriteBigDecimalAsPlain,
MapSortField;