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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
John_Martel
New Member

Generic way to expand all columns in Power Query from the import of a nested JSON format

Hello,

 

I often deal with complex nested JSON files that consist of array of records of array of records etc... What I would like to do is to be import the JSON file in an "all-expanded mode" where are all the columns of lists and records are expanded . Right now i have to repeatdly click on the "double arrow" on the header of every expandable column to split a column of lists or a column of records until there are no more expandable columns . Given that the JSON files have deep nesting manually clicking to expand columns is not practical, moreoever since the JSON files have varying formats, i cannot create a function from the steps recorded when expanding column after column. Is there a general way to expand all columns in a table?

1 ACCEPTED SOLUTION
edhans
Super User
Super User

I don't think so. When you expand, it changes the shape of the table, and expanding in different orders or ways will change the outcome. Expanding a nested list to rows will impact how a subsequent list expansion will happen, so even if someone were to write function that would loop through all lists and tables and expand, they best they could do is expand them in a specific order (first to last) in a specific way, (to rows, to columns if availalble), all of which can change the results.



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
edhans
Super User
Super User

I don't think so. When you expand, it changes the shape of the table, and expanding in different orders or ways will change the outcome. Expanding a nested list to rows will impact how a subsequent list expansion will happen, so even if someone were to write function that would loop through all lists and tables and expand, they best they could do is expand them in a specific order (first to last) in a specific way, (to rows, to columns if availalble), all of which can change the results.



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

Thanks for your answer. It makes sense. In my case, I dont really care about the order of the columns. So my best bet is to write a function.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors