Examples | CSV_TO_JSON Table Operator | Teradata Vantage - Example: Converting CSV to JSON - Advanced SQL Engine - Teradata Database

DATASET Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
des1556232910526.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1198
lifecycle
previous
Product Category
Teradata Vantageā„¢

The following is a simple example of converting CSV to JSON, where each CSV record is converted to one output row composed of one JSON object.

SELECT * FROM CSV_TO_JSON
(
	ON (SELECT csvFile FROM myCSVTable09 WHERE id=2)
	USING SCHEMA('{"record_delimiter":"#"}')
) AS csvJSON ORDER BY data."Item ID";

> {"Item_ID":"55", "Item_Name":"bicycle", "Item_Color":"red", "Item_Style":"boys", "Quantity_Purchased":"1", "Item_Price":"100.00", "Total_Price":"100.00"}
> {"Item_ID":"88", "Item_Name":"toy boat", "Item_Color":"pink", "Item_Style":null, "Quantity_Purchased":"1", "Item_Price":"15.10", "Total_Price":"15.10"}
> {"Item_ID":"105", "Item_Name":"soap", "Item_Color":null, "Item_Style":null, "Quantity_Purchased":"1", "Item_Price":"0.99", "Total_Price":"0.99"}