Example: Use JSON_KEYS to Obtain Key Names with No Depth Specified - Advanced SQL Engine - Teradata Database

JSON Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
gzn1554761068186.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1150
lifecycle
previous
Product Category
Teradata Vantage™
The example uses JSON_KEYS to obtain the key names of a JSON object. No depth is specified, so the entire depth is searched and the keys at all levels are returned.
SELECT * from JSON_KEYS
(
ON (SELECT json_data FROM json_table))
AS json_data;
Result:
KEYS
----
“coord”
“coord”.”lon”
“coord”.”lat”
“sys”
“sys”.”country”
“sys”.”sunrise”
“sys”.”sunset”
“weather”
“weather”[0].”id”
“weather”[0].”main”
“weather”[0].”description”
“weather”[0].”icon”
“base”
“main”
“main”.”temp”
“main”.”humidity”
“main”.”pressure”
“main”.”temp_min”
“main”.”temp_max”
“wind”
“wind”.”speed”
“wind”.”deg”
“clouds”
“clouds”.”all”
“dt”
“id”
“name”
“cod”