Example: Array to JSON Type Conversion Using the ARRAY_TO_JSON Function - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530
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]]