Skip to main content

参数

any
必填
要 encode 和 decode 的 Value。Supported JSON values 会通过 JSON round-trip;unsupported types 默认 encode 为 null,除非 encode options 要求 error。
EncodeOptions
传给 encode step 的 Optional encode options,例如 sortKeys、emptyTableAsArray、errorOnUnsupported、encodeInvalidNumbersAsNull、maxDepth、pretty 和 indent。

返回值

any
由 encoded JSON 生成的 Decoded value。Objects 和 arrays 是带有 decoder 生成的 JSON kind markers 的 new tables;JSON null values 会变成 json.null。

类型

EncodeOptions

控制 JSON 序列化和格式设置。

示例

在更改 nested values 之前,让 JSON-compatible value 通过 json.encode 和 json.decode round-trip。