All Products
Search
Document Center

MaxCompute:JSON_PRETTY

Last Updated:Jul 28, 2023

Beautifies a JSON expression by adding line feeds and spaces.

Syntax

string json_pretty(<json>)

Parameters

json: required. This parameter specifies the JSON expression that you want to process.

Return value

The return value is of the STRING type.

Examples

-- Beautify a JSON object.
select json_pretty(json '{"a":1, "b":2}');

The following result is returned:

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

Related functions

JSON_PRETTY is a complex type function. For more information about the functions that are used to process data of complex data types, such as ARRAY, MAP, STRUCT, and JSON, see Complex type functions.