Forum Discussion
Loading firebase database to Power BI
- 9 years ago
Another approach is to use the function Record.ToTable(json) to drill down the json path. Please follow the query example below
let
json = Json.Document(File.Contents("C:\Users\cotrutai\Downloads\test.json")),
level0 = Record.ToTable(json),
level1 = Table.AddColumn(level0, "level1", each Record.ToTable([Value])),
level1_exp = Table.ExpandTableColumn(level1, "level1", {"Name", "Value"}, {"level1.Name", "level1.Value"}),
level2 = Table.AddColumn(level1_exp, "level2", each Record.ToTable([level1.Value])),
level2_exp = Table.ExpandTableColumn(level2, "level2", {"Name", "Value"}, {"level2.Name", "level2.Value"}),
out = Table.ExpandRecordColumn(level2_exp, "level2.Value", {"date", "eatmyvegetables", "postponeuntildeadline", "r", "score", "telltruthtospouse"}, {"date", "eatmyvegetables", "postponeuntildeadline", "r", "score", "telltruthtospouse"})
in
out
Another approach is to use the function Record.ToTable(json) to drill down the json path. Please follow the query example below
let
json = Json.Document(File.Contents("C:\Users\cotrutai\Downloads\test.json")),
level0 = Record.ToTable(json),
level1 = Table.AddColumn(level0, "level1", each Record.ToTable([Value])),
level1_exp = Table.ExpandTableColumn(level1, "level1", {"Name", "Value"}, {"level1.Name", "level1.Value"}),
level2 = Table.AddColumn(level1_exp, "level2", each Record.ToTable([level1.Value])),
level2_exp = Table.ExpandTableColumn(level2, "level2", {"Name", "Value"}, {"level2.Name", "level2.Value"}),
out = Table.ExpandRecordColumn(level2_exp, "level2.Value", {"date", "eatmyvegetables", "postponeuntildeadline", "r", "score", "telltruthtospouse"}, {"date", "eatmyvegetables", "postponeuntildeadline", "r", "score", "telltruthtospouse"})
in
out
That worked! Thanks hugoberry :-)