JSON_SERIALIZE 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_SERIALIZE function

The JSON_SERIALIZE function serializes a SUPER expression into textual JSON representation to follow RFC 8259. For more information on that RFC, see The JavaScript Object Notation (JSON) Data Interchange Format.

The SUPER size limit is approximately the same as the block limit, and the VARCHAR limit is smaller than the SUPER size limit. Therefore, the JSON_SERIALIZE function returns an error when the JSON format exceeds the varchar limit of the system. To check the size of a SUPER expression, see the JSON_SIZE function.

Syntax

JSON_SERIALIZE(super_expression)

Arguments

super_expression

A SUPER expression or column.

Return type

VARCHAR

Examples

To serialize a SUPER value to a string, use the following example.

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