cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to convert STRING column into Array of Structs in SQL statement

BamBam
New Contributor II

I have STRING column in a DLT table that was loaded using SQL Autoloader via a JSON file. When I use the "schema_of_json" function in a SQL statement passing in the literal string from the STRING column then I get this output:

ARRAY<STRUCT<firstFetchDate: STRING, lastFetchDate: STRING, matchedObjectArray: ARRAY<STRUCT<highlightSnippet: STRING, matchedObjectAPI: STRING, matchedObjectAttribute: STRING, matchedObjectId: STRING, matchedObjectName: STRING, object: STRING>>, name: STRING, normDetailsAPI: STRING, normId: STRING, object: STRING>>

I am trying to figure out how to get this STRING datatype into a more structure format using a SQL statement.  

Thanks for the help.

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group