Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MarshalWrite = json.MarshalWrite UnmarshalRead = json.UnmarshalRead )
MarshalWrite 和 UnmarshalRead 是 encoding/json/v2 对应函数的别名, 直接读写 io.Writer 和 io.Reader,避免中间 []byte 载体。
View Source
var ( // StringifyNumbers 序列化和反序列化都生效:数字以 JSON 字符串形式编码和解析。 StringifyNumbers = json.StringifyNumbers // Deterministic 仅序列化生效:相同输入始终序列化为相同字节,map 按键排序。 Deterministic = json.Deterministic // FormatNilSliceAsNull 仅序列化生效:nil 切片编码为 null,而非默认的空数组或空字符串。 FormatNilSliceAsNull = json.FormatNilSliceAsNull // FormatNilMapAsNull 仅序列化生效:nil map 编码为 null,而非默认的空对象。 FormatNilMapAsNull = json.FormatNilMapAsNull // OmitZeroStructFields 仅序列化生效:省略零值结构体字段,等价于所有字段附加 omitzero。 OmitZeroStructFields = json.OmitZeroStructFields // MatchCaseInsensitiveNames 序列化和反序列化都生效:JSON 成员名与结构体字段不区分大小写匹配。 MatchCaseInsensitiveNames = json.MatchCaseInsensitiveNames // RejectUnknownMembers 仅反序列化生效:JSON 对象出现未知成员时报错。 RejectUnknownMembers = json.RejectUnknownMembers )
以下变量是 encoding/json/v2 选项构造函数的别名,可直接传给本包和上游的编解码函数。
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.