All Products
Search
Document Center

MaxCompute:JSON_PRETTY

Last Updated:Mar 25, 2026

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.