0

I am new to Power Query and I am having a JSON as follows:

{
"Team": [
    {
        "TeamId": "1",
        "TeamName": "Chicago Bulls",
        "TeamPlayers": [
            {"PlayerId": "1", "PlayerName": "Pau Gasol"},
            {"PlayerId": "2", "PlayerName": "Derrick Rose"},
            {"PlayerId": "3", "PlayerName": "Joakim Noah"},
            {"PlayerId": "4", "PlayerName": "Jimmy Butler"},
            {"PlayerId": "5", "PlayerName": "Taj Gibson"}
        ]
    },
    {
        "TeamId": "2",
        "TeamName": "Cleveland Cavaliers",
        "TeamPlayers": [
            {"PlayerId": "1", "PlayerName": "Lebron James"},
            {"PlayerId": "2", "PlayerName": "Kyrie Irving"},
            {"PlayerId": "3", "PlayerName": "Anderson Varejao"},
            {"PlayerId": "4", "PlayerName": "Dion Waiters"},
            {"PlayerId": "5", "PlayerName": "Shawn Marion"}
        ]
    },
    {
        "TeamId": "3",
        "TeamName": "Los Angeles Clippers",
        "TeamPlayers": [
            {"PlayerId": "1", "PlayerName": "Chris Paul"},
            {"PlayerId": "2", "PlayerName": "Blake Griffin"},
            {"PlayerId": "3", "PlayerName": "DeAndre Jordan"},
            {"PlayerId": "4", "PlayerName": "Jamal Crawford"},
            {"PlayerId": "5", "PlayerName": "Matt Barnes"}
        ]
    }
]}

The number of columns in this JSON file can be changed along with the content it holds.

For example: There may be an addition to new columns containing lists or records in them, or there may be a decrease in number of the columns in many JSON files requiring further.

I want to write a code in M language in such a way that, I could be able to expand all the columns in the JSON file at once, including the lists and records, irrespective of the number/name/content of the column. This has to happen dynamically (i.e., the next file may have 10 number of columns with lists and records in any/all of the columns).

So the above JSON file should be something as follows, but dynamically: Expanded data

Any help is greatly appreciated.

Thanks in advance!

SIM
  • 17
  • 4
  • @AzatIbrakov Here, JSON is the data sample. I have added what is desired in an image form. It is the desired output in a dynamic way. Hence, it is just needed for viewing purposes. – SIM Jan 22 '19 at 10:36
  • Related posts: [Dynamically expand ALL lists and records from json](https://stackoverflow.com/questions/48542013/dynamically-expand-all-lists-and-records-from-json), [How can I turn the deepest elements of nested JSON payload into individual rows in Power Query?](https://stackoverflow.com/questions/37715592/how-can-i-turn-the-deepest-elements-of-nested-json-payload-into-individual-rows) – Alexis Olson Jan 22 '19 at 16:37
  • What have you tried so far, and what is the specific problem you're having? – Olly Jan 23 '19 at 09:11

0 Answers0