JSON_PARSE function - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

JSON_PARSE function

The JSON_PARSE function parses data in JSON format and converts it into the SUPER representation.

To ingest into SUPER data type using the INSERT or UPDATE command, use the JSON_PARSE function. When you use JSON_PARSE() to parse JSON strings into SUPER values, certain restrictions apply. For additional information, see Parsing options for SUPER.

Syntax

JSON_PARSE( {json_string | binary_value} )

Arguments

json_string

An expression that returns serialized JSON as a VARBYTE or VARCHAR type.

binary_value

A VARBYTE type binary value.

Return type

SUPER

Examples

To convert the JSON array [10001,10002,"abc"] into the SUPER data type, use the following example.

SELECT JSON_PARSE('[10001,10002,"abc"]'); +---------------------+ | json_parse | +---------------------+ | [10001,10002,"abc"] | +---------------------+

To make sure that the function converted the JSON array into the SUPER data type, use the following example. For more information, see JSON_TYPEOF function

SELECT JSON_TYPEOF(JSON_PARSE('[10001,10002,"abc"]')); +-------------+ | json_typeof | +-------------+ | array | +-------------+