AsJSONText JSON Method Example | Teradata Vantage - Example: Get the Text Representation of BSON Data - 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ā„¢

In this example, the column j1 contains JSON data in BSON format. The AsJSONText method is called to get the text representation of this BSON data.

CREATE TABLE jsonTable(id INTEGER, j1 JSON STORAGE FORMAT BSON);

/*insert {"hello": "world"} as BSON*/
INSERT INTO jsonTable(1, '160000000268656C6C6F0006000000776F726C640000'xb);

SELECT j1.AsJSONText() FROM jsonTable;

Result:

j1.AsJSONText()
------------------
{"hello": "world"}