Skip to content

Commit 229fab0

Browse files
yanxutao89wenshao
authored andcommitted
doc improve NullAsDefaultValue introduction
1 parent 80c005c commit 229fab0

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

docs/features_cn.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,42 @@ class Model {
5858
| DisableSingleQuote | Do not allow single quote on key and value
5959
# 5. JSONWriter.Feature介绍
6060

61-
| JSONWriter.Feature | 介绍 |
62-
|-----------------------------------|---------------------------------------------------------------------------------------|
63-
| FieldBased | 基于字段序列化,如果不配置,会默认基于public的field和getter方法序列化。配置后,会基于非static的field(包括private)做序列化。 |
64-
| IgnoreNoneSerializable | 序列化忽略非Serializable类型的字段 |
65-
| BeanToArray | 将对象序列为[101,"XX"]这样的数组格式,这样的格式会更小 |
66-
| WriteNulls | 序列化输出空值字段 |
67-
| BrowserCompatible | 在大范围超过JavaScript支持的整数,输出为字符串格式 |
68-
| NullAsDefaultValue | 将空置输出为缺省值,Number类型的null都输出为0,String类型的null输出为"",数组和Collection类型的输出为[] |
69-
| WriteBooleanAsNumber | 将true输出为1,false输出为0 |
70-
| WriteNonStringValueAsString | 将非String类型的值输出为String,不包括对象和数据类型 |
71-
| WriteClassName | 序列化时输出类型信息 |
72-
| NotWriteRootClassName | 打开WriteClassName的同时,不输出根对象的类型信息 |
73-
| NotWriteHashMapArrayListClassName | 打开WriteClassName的同时,不输出类型为HashMap/ArrayList类型对象的类型信息,反序列结合UseNativeObject使用,能节省序列化结果的大小 |
74-
| NotWriteDefaultValue | 当字段的值为缺省值时,不输出,这个能节省序列化后结果的大小 |
75-
| WriteEnumsUsingName | 序列化enum使用name |
76-
| WriteEnumUsingToString | 序列化enum使用toString方法 |
77-
| IgnoreErrorGetter | 忽略setter方法的错误 |
78-
| PrettyFormat | 格式化输出 |
79-
| ReferenceDetection | 打开引用检测,这个缺省是关闭的,和fastjson 1.x不一致 |
80-
| WriteNameAsSymbol | 将字段名按照symbol输出,这个仅在JSONB下起作用 |
81-
| WriteBigDecimalAsPlain | 序列化BigDecimal使用toPlainString,避免科学计数法 |
82-
| UseSingleQuotes | 使用单引号 |
83-
| MapSortField | 对Map中的KeyValue按照Key做排序后再输出。在有些验签的场景需要使用这个Feature |
84-
| WriteNullListAsEmpty | 将List类型字段的空值序列化输出为空数组"[]" |
85-
| WriteNullStringAsEmpty | 将String类型字段的空值序列化输出为空字符串"" |
86-
| WriteNullNumberAsZero | 将Number类型字段的空值序列化输出为0 |
87-
| WriteNullBooleanAsFalse | 将Boolean类型字段的空值序列化输出为false |
88-
| NotWriteEmptyArray | 数组类型字段当length为0时不输出 |
89-
| WriteNonStringKeyAsString | 将Map中的非String类型的Key当做String类型输出 |
90-
| ErrorOnNoneSerializable | 序列化非Serializable对象时报错 |
91-
| WritePairAsJavaBean | 将 Apache Common 包中的Pair对象当做JavaBean序列化 |
92-
| BrowserSecure | 浏览器安全,将会'<' '>' '(' ')'字符做转义输出 |
93-
| WriteLongAsString | 将Long序列化为String |
94-
| WriteEnumUsingOrdinal | 序列化Enum使用Ordinal,缺省是name |
95-
| WriteThrowableClassName | 序列化Throwable时带上类型信息 |
96-
| LargeObject | 这个是一个保护措施,是为了防止序列化有循环引用对象消耗过大资源的保护措施。 |
97-
| UnquoteFieldName | 不带引号输出Key |
98-
| NotWriteSetClassName | 当打开WriteClassName时又不想输出Set的类型信息,使用这个Feature |
99-
| NotWriteNumberClassName | 当打开WriteClassName时又不想输出Number的类型信息,比如L/S/B/F/D这种后缀,使用这个Feature |
61+
| JSONWriter.Feature | 介绍 |
62+
|-----------------------------------|------------------------------------------------------------------------------------------------------------------|
63+
| FieldBased | 基于字段序列化,如果不配置,会默认基于public的field和getter方法序列化。配置后,会基于非static的field(包括private)做序列化。 |
64+
| IgnoreNoneSerializable | 序列化忽略非Serializable类型的字段 |
65+
| BeanToArray | 将对象序列为[101,"XX"]这样的数组格式,这样的格式会更小 |
66+
| WriteNulls | 序列化输出空值字段 |
67+
| BrowserCompatible | 在大范围超过JavaScript支持的整数,输出为字符串格式 |
68+
| NullAsDefaultValue | 将null值输出为缺省值,整数类型的Number输出为0,小数类型的Number输出为0.0,String类型输出为"",Character类型输出为\u0000,数组和Collection类型输出为[],其余类型输出{}。 |
69+
| WriteBooleanAsNumber | 将true输出为1,false输出为0 |
70+
| WriteNonStringValueAsString | 将非String类型的值输出为String,不包括对象和数据类型 |
71+
| WriteClassName | 序列化时输出类型信息 |
72+
| NotWriteRootClassName | 打开WriteClassName的同时,不输出根对象的类型信息 |
73+
| NotWriteHashMapArrayListClassName | 打开WriteClassName的同时,不输出类型为HashMap/ArrayList类型对象的类型信息,反序列结合UseNativeObject使用,能节省序列化结果的大小 |
74+
| NotWriteDefaultValue | 当字段的值为缺省值时,不输出,这个能节省序列化后结果的大小 |
75+
| WriteEnumsUsingName | 序列化enum使用name |
76+
| WriteEnumUsingToString | 序列化enum使用toString方法 |
77+
| IgnoreErrorGetter | 忽略setter方法的错误 |
78+
| PrettyFormat | 格式化输出 |
79+
| ReferenceDetection | 打开引用检测,这个缺省是关闭的,和fastjson 1.x不一致 |
80+
| WriteNameAsSymbol | 将字段名按照symbol输出,这个仅在JSONB下起作用 |
81+
| WriteBigDecimalAsPlain | 序列化BigDecimal使用toPlainString,避免科学计数法 |
82+
| UseSingleQuotes | 使用单引号 |
83+
| MapSortField | 对Map中的KeyValue按照Key做排序后再输出。在有些验签的场景需要使用这个Feature |
84+
| WriteNullListAsEmpty | 将List类型字段的空值序列化输出为空数组"[]" |
85+
| WriteNullStringAsEmpty | 将String类型字段的空值序列化输出为空字符串"" |
86+
| WriteNullNumberAsZero | 将Number类型字段的空值序列化输出为0 |
87+
| WriteNullBooleanAsFalse | 将Boolean类型字段的空值序列化输出为false |
88+
| NotWriteEmptyArray | 数组类型字段当length为0时不输出 |
89+
| WriteNonStringKeyAsString | 将Map中的非String类型的Key当做String类型输出 |
90+
| ErrorOnNoneSerializable | 序列化非Serializable对象时报错 |
91+
| WritePairAsJavaBean | 将 Apache Common 包中的Pair对象当做JavaBean序列化 |
92+
| BrowserSecure | 浏览器安全,将会'<' '>' '(' ')'字符做转义输出 |
93+
| WriteLongAsString | 将Long序列化为String |
94+
| WriteEnumUsingOrdinal | 序列化Enum使用Ordinal,缺省是name |
95+
| WriteThrowableClassName | 序列化Throwable时带上类型信息 |
96+
| LargeObject | 这个是一个保护措施,是为了防止序列化有循环引用对象消耗过大资源的保护措施。 |
97+
| UnquoteFieldName | 不带引号输出Key |
98+
| NotWriteSetClassName | 当打开WriteClassName时又不想输出Set的类型信息,使用这个Feature |
99+
| NotWriteNumberClassName | 当打开WriteClassName时又不想输出Number的类型信息,比如L/S/B/F/D这种后缀,使用这个Feature |

docs/features_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Model {
6969
| BeanToArray | Sequence the objects into an array format like [101,"XX"], which will be smaller. |
7070
| WriteNulls | Serialize write null field |
7171
| BrowserCompatible | Over a wide range of integers than JavaScript supports, the output is in string format. |
72-
| NullAsDefaultValue | The null value is output as the default value, the null of the Number type is output as 0, the null output of the String type is "", and the output of the array and Collection type is []. |
72+
| NullAsDefaultValue | The null value is output as the default value, the whole Number type as 0, the decimal Number type as 0.0, the String type as "", the Character type as \u0000, the array and Collection type as [], and the others as {}. |
7373
| WriteBooleanAsNumber | Write true as 1 and false as 0. |
7474
| WriteNonStringValueAsString | Write values of non-String types as Strings, excluding objects and data types. |
7575
| WriteClassName | Write type information when serializing. |

0 commit comments

Comments
 (0)