Forum Discussion

TedElk's avatar
TedElk
New Member
2 years ago
Solved

Parsing Heavily Nested JSON file - new to Power Query/M - help please?

Hi,   I'm new to Power Query and the M language. I've been struggling for some time now to parse the "print_history", "waste_tracking_events", and "other_waste_tracking" data from the json file's s...
  • lbendlin's avatar
    2 years ago

    Yes, you basically wandered into the wrong path.  This here will give you all the records under "other"

     

     

     

     

     

     

    let
        Source = Json.Document(File.Contents("C:\Users\xxx\Downloads\TestData.json")),
        #"Converted to Table" = Table.FromRecords({Source}),
        #"Expanded data" = Table.ExpandRecordColumn(#"Converted to Table", "data", {"systems"}, {"data.systems"}),
        #"Expanded data.systems1" = Table.ExpandRecordColumn(#"Expanded data", "data.systems", {"other_waste_tracking"}){0}[other_waste_tracking][systems]
    in
        #"Expanded data.systems1"

     

     

     

     

     

    if you wanted to combine them with the other system then you would need to indicate how you want to do that as one of them has "print_history" and the others have "waste_history"