JSON_PRETTY

更新时间:
复制 MD 格式

Formats a JSON value with line breaks and indentation for readability.

Syntax

string json_pretty(<json>)

Parameters

ParameterRequiredDescription
jsonYesThe JSON value to format.

Returns

STRING

Examples

JSON object

SELECT json_pretty(json '{"a":1, "b":2}');

Result:

+-----+
| _c0 |
+-----+
| {
    "a":1,
    "b":2
} |
+-----+

Related functions

json_pretty is a complex type function. For more information about functions for processing ARRAY, MAP, STRUCT, and JSON data, see Complex type functions.