All Products
Search
Document Center

MaxCompute:JSON_FORMAT

Last Updated:Jul 28, 2023

Converts JSON data into data of the STRING type. By default, automatic beautification is not performed during the conversion.

Syntax

string json_format(<json>)

Parameters

json: required. This parameter specifies the JSON data that you want to convert.

Return value

The return value is of the STRING type.

Examples

  • Example 1: Convert JSON NUMBER data into strings.

    select json_format(json '123');

    The following result is returned:

    +-----+
    | _c0 |
    +-----+
    | 123 |
    +-----+
  • Example 2: Convert JSON STRING data into strings.

    select json_format(json '"123"');

    The following result is returned:

    +-----+
    | _c0 |
    +-----+
    | "123" |
    +-----+

Related functions

JSON_FORMAT 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.