Skip to main content

参数

string
必填
Formatting 前要 parse 的 JSON string。function 使用 string type checking 读取这个 argument。
EncodeOptions
传给 re-encode step 的 optional encode options。json.format 读取与 json.encode 相同的 encode options,然后强制 pretty 为 true。
DecodeOptions
Parsing input JSON 时使用的 optional decode options。boolean 设置 useNull。table 可以设置 useNull 和 maxDepth。

返回值

string
Parsing 并 re-encoding input 后产生的 readable formatted JSON string。

类型

EncodeOptions

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

DecodeOptions

控制 JSON 解析行为。

示例

Parse existing JSON,并 re-encode 为 readable formatted JSON。