How parsing multi level nested json file in Power Query

Mourad BENKADOUR 76 Reputation points
2021-03-31T19:37:04.59+00:00

Hi,
I'm struggling right now to find an easy and efficient way to parse multi level nested json file. πŸ™„
I can import json file in Power query Editor --> convert it to table --> extend records --> extract lists.

But it's very heavy task to do that many times for a complex big json file πŸ˜•

And also there is a difficult case when there are records and lists in the same column.

I ask if there is a efficient way to parse all multi level nested json file that will work for different kind of json file?

@Miguel Escobar @Chris Webb

Thanks in advance,
Mourad

Community Center | Not monitored
0 comments No comments
{count} votes

Accepted answer
  1. Miguel Escobar 326 Reputation points Volunteer Moderator
    2021-04-01T21:57:40.96+00:00

    I forgot to mention this, but there's a preview feature called "json table inference" which could help you quite a bit:
    ![83757-image.png]1

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Miguel Escobar 326 Reputation points Volunteer Moderator
    2021-04-01T21:02:37.33+00:00

    I do agree. Flattening a json file could be a tedious task, but at the same not all json files are created exactly the same and flattening without knowing the structure of the file could yield some denormalization that you might be trying to avoid.

    There are methods to recursively look through the json file and flatten everything, but I try to avoid doing that and have full control over what I do with the json file.


  2. Jean-Yves Vinet 1 Reputation point
    2022-02-27T15:29:26.173+00:00

    Hi

    If you up to learn more about PowerQuery M language, here are some documented examples how to read complex json files with deep hierarchy.

    https://github.com/vinej/PowerQuery

    Thanks

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.