Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
bhmann
New Member

Transforming JSON string embedded in SQL Table

I have an Azure SQL DB that is storing JSON data in one of the columns. Long story on why it is structured this way, but the short answer is "No, I can't change the way the data is stored." This is what the data looks like:

Data in PBI

 

Each variable has a four digit label [e.g. "7x3d"], and then has either a single value [e.g. "12"] or an array of two nested variables, each with their own values or array of values [e.g.{"choice_values":["ABC", "123"], "other_values": ["XKCD"]}.

 

The challenge I am facing is how to convert the JSON String of data into useable values. My approach is to use some mix of split by delimiter, filter, and or replace characters to split the "form_values" column into two columns (like an unpivoted table) attribute name ["7x3d"] and then values ["12"]. What I cannot figure out is the right mix of steps in Power Query to transform the column. 

 

Two Questions:

  1. Am I on the right track? Or is there some other function (maybe Text.ToBinary?) that can parse the JSON string? Is there a way to have Power BI recognize that this specific column inside my SQL DB is actually a JSON and then use the typical approach for transforming JSON records/lists/etc. in the avanced editor?
  2. If my approach is sound, is there anyone smarter than I who can figure out how to split the individual cells with each JSON record into rows by variable name, without losing the nested arrays? (see my manual example below)

Excel Manual Example

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @bhmann,

 

To recognize the JSON string embedded in a SQL table, please add a custom column like this:

Custom=Json.Document([ColumnName])

2.PNG

 

Then, you can expand the new column to extract your desired values.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @bhmann,

 

To recognize the JSON string embedded in a SQL table, please add a custom column like this:

Custom=Json.Document([ColumnName])

2.PNG

 

Then, you can expand the new column to extract your desired values.

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors