Reference for JSON_FORMAT function family
Parameter | Description | Supported input types |
---|---|---|
<json> | The JSON document. | TEXT |
<indentation> | The indentation to use for formatting. | TEXT or INT |
<indentation>
defaults to 4
if omitted.
<indentation>
must be a literal value and cannot be NULL
.
TEXT
<json>
is NULL
, the function will return NULL
.<json>
is malformed, the TRY_
variants return NULL
whereas the non-TRY_
variants fail with an error message.<indentation>
as explained below:
Value of <indentation> | Mode | Description |
---|---|---|
-1 or 'mini' | minify | Produces the most compact representation, omitting any white spaces. |
0 or 'newline' | newlines | Only insert newlines but no spaces for indentation. |
one of 1 , 2 , 4, 8 , or 'pretty' | pretty-print | Pretty-print with newlines and specified indentation. |
<indentation>
of 'pretty'
is identical to 4
.
<json_common_example>
below, see our JSON common example.
The returned results are based on the following example.
NULL
for the malformed JSON document.