15.10 - Example: Array to JSON Type Conversion Using the ARRAY_TO_JSON Function - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty
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]]