cancel
Showing results for 
Search instead for 
Did you mean: 
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 III
Super User III

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

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

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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Kudoed Authors