Read and parse JSON in SQL / Teradata

access_time 2 years ago visibility558 comment 0

JSON is commonly used in modern applications for data storage and transfers. Pretty much all programming languages provide APIs to parse JSON. 

From Teradata version 15.0, JSON shredding functions are added. JSONExtractValue function can be used to extract JSON data from JSON object.  NEW JSON can be used to convert string to JSON object. 

In Teradata JSON native data type is also supported. Shredding functions allow you to extract vJSON documents up to 16MB in size. 

Code snippet

SELECT jsonObj.Name AS Name,
    jsonObj.JSONExtractValue('$.Value') AS "Value"
    FROM
    (
    SELECT NEW json('{"Name":"A","Value":2}') AS jsonObj) AS r;
info Last modified by Raymond at 2 years ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

local_offer pyspark local_offer spark-2-x local_offer teradata local_offer SQL Server local_offer spark-database-connect

visibility 4805
thumb_up 0
access_time 7 months ago

In my previous article about  Connect to SQL Server in Spark (PySpark) , I mentioned the ways to read data from SQL Server databases as dataframe using JDBC. We can also use JDBC to write data from Spark dataframe to database tables. In the following sections, I'm going to show you how to ...

local_offer SQL local_offer hive

visibility 4567
thumb_up 1
access_time 11 months ago

In different databases, the syntax of selecting top N records are slightly different. They may also differ from ISO standards.

local_offer teradata local_offer fastload local_offer teradata-utilities

visibility 24
thumb_up 0
access_time 16 days ago

Teradata FastLoad is a command line utility that can be used to load large amount of data into an empty table on Teradata database. The performance will be greater than line by line or batch processing mechanism. This article provides example of using FastLoad to load CSV file into Teradata ...

About column

Code snippets for various programming languages/frameworks.

rss_feed Subscribe RSS