Skip to main content

Arguments

string
required
JSON string to parse before formatting. The function reads this argument with string type checking.
EncodeOptions
Optional encode options passed to the re-encode step. json.format reads the same encode options as json.encode, then forces pretty to true.
DecodeOptions
Optional decode options used while parsing the input JSON. A boolean sets useNull. A table can set useNull and maxDepth.

Returns

string
Readable formatted JSON string produced after parsing and re-encoding the input.

Types

EncodeOptions

Controls JSON serialization and formatting.

DecodeOptions

Controls JSON parsing behavior.

Example

Parse existing JSON and re-encode it as readable formatted JSON.