Example: Array to JSON Type Conversion Using the ARRAY_TO_JSON Function

Teradata Vantageā„¢ JSON Data Type

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1150-162K
Use the ARRAY_TO_JSON function to convert an array to a JSON type composed of an ARRAY and return the data in both LATIN and UNICODE character sets.
SELECT (ARRAY_TO_JSON(a) RETURNS JSON(20) CHARACTER SET LATIN),
       (ARRAY_TO_JSON(b) RETURNS JSON(100) CHARACTER SET UNICODE)
FROM arrayTable;
Result:
ARRAY_TO_JSON(a)   ARRAY_TO_JSON(b)
----------------------------------------
[1,2,3,4,5]        [[1,2,3], [4,5,6], [7,8,9]]