HTTP & JSON
jsonPretty
$jsonPretty[]
Prettifies the current internal JSON structure into a human-readable, indented JSON string for display or debugging.
Syntax
$jsonPretty[indent?]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| indent | integer | Optional |
2
|
Number of spaces to use for indentation. Defaults to 2 if omitted. |
Return Value
string
A pretty-printed JSON string with line breaks and indentation. Returns an empty string if no JSON context exists.
$jsonPretty is useful for debugging JSON data or displaying it to users in a readable format. Unlike $jsonStringify which produces compact output, $jsonPretty adds line breaks and indentation. Use inside code blocks (```json) for embed descriptions. If no JSON context exists, returns an empty string.
Examples
Pretty-print JSON with default indentation
$jsonParse[{"name":"Alice","age":25}]
$jsonPretty[]
Pretty-print with 4-space indent
$jsonParse[$httpResult]
$jsonPretty[4]
Display pretty-printed JSON in an embed
$jsonParse[{"status":"ok","data":{"count":42}}]
$title[API Response]
$description[```json
$jsonPretty[]
```]