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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Jan_Hob
Helper I
Helper I

JSON column type in Power BI Dataflow

I am using the following code to pull in data from an API in a Power BI Dataflow

 

Json.Document(Web.Contents("https://"&APIEnvironment&"/path/" & "?limit=100", [ Headers=[Authorization="Bearer " & #"AccessToken"]]))

 

This pulls back a column with nested record which I can expand.  

 

As an alternative is there anyway of not expanding the nested records and just having the pulled back field as a JSON type.  I would like to then connect to the dataflow and expand the JSON type in the Power Query in the desktop version.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

No. I am not aware of any way to return embedded lists, records, etc. in a loaded dataflow. 
This simple table:

let
  Source = #table(
            {"ID", "Name", "City"},
                {
                    {123, "Alice", {1.10}},
                    {456, "Bob", {100.150}}
                }
          )
in
  Source

has a nested list in the third column. When that is loaded in a dataflow nothing comes through into Power BI's Power Query. it is just a blank field.

edhans_0-1665024960863.png

You will need to do the expansion in the dataflow, or connect to the JSON directy from Power BI's Power Query if you want to expand it there.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
Neomarty
New Member

I faced the same issue and struggled to have the pulled back field as a JSON type. Eventually, I ended up converting the JSON into text type (jsontext variable below) using the code below. The text can then be parsed and transformed into JSON using Power Query GUI.

 

 

 

let
    Source = Query(),
    jsontext = Text.FromBinary(Json.FromValue(Source)),
    #"Convert to table" = Table.FromValue(jsontext),
    #"Changed column type" = Table.TransformColumnTypes(#"Convert to table", {{"Value", type text}})
in
    #"Changed column type"

 

 

 

Function code:

 

 

let
    Source = () as list =>
    let
    Token = "token"
    body = Text.ToBinary("{""limit"":1000000}"),
    actualUrl = "url",
    options = [RelativePath="relative_path" ,
    Headers =[#"Content-type"="application/json",Authorization="Bearer "&""& Token &""],
    Content= body
    ],
    result = Web.Contents(actualUrl, options),
    #"Imported JSON" = Json.Document(result, 65001)
in
    #"Imported JSON"
in
    Source

 

 

 

 

edhans
Super User
Super User

No. I am not aware of any way to return embedded lists, records, etc. in a loaded dataflow. 
This simple table:

let
  Source = #table(
            {"ID", "Name", "City"},
                {
                    {123, "Alice", {1.10}},
                    {456, "Bob", {100.150}}
                }
          )
in
  Source

has a nested list in the third column. When that is loaded in a dataflow nothing comes through into Power BI's Power Query. it is just a blank field.

edhans_0-1665024960863.png

You will need to do the expansion in the dataflow, or connect to the JSON directy from Power BI's Power Query if you want to expand it there.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors