Skip to content
HTTP & JSON jsonPretty

$jsonPretty[]

$jsonPretty returns the JSON document with line breaks and indentation, unlike $jsonStringify which is compact. The document is not modified.

Syntax

bdfd
$jsonPretty[(indent)]

Parameters

Parameter Description
indent Optional. Number of spaces per level. Default: 2. A non-numeric or negative value also gives 2. 0 keeps the line breaks but removes the indentation.

Behavior

  • Returns an empty string when no JSON document exists yet.

Examples

Format JSON Output

$jsonParse[{"status":"ok","code":200}]
$title[Pretty Printed JSON]
$description[$jsonPretty]
$color[#5865F2]

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.