15.10 - Example: Using JSON_AGG without GROUP BY and No Parameter Names - Teradata Database

Teradata Database Teradata JSON

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1150-151K
The example selects columns from a table and uses JSON_AGG to compose those columns into JSON objects.
SELECT JSON_agg(empID, company, empName, empAge)
FROM emp_table;

Result:

JSON_agg
--------
[{ "empID" : 1, "company" : "Teradata", "empName" : "Cameron", "empAge" : 24 },{ "empID" : 2, "company" : "Teradata", "empName" : "Justin", "empAge" : 34 },{ "empID" : 3, "company" : "Teradata", "empName" : "Someone", "empAge" : 24 }]