Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
how to read JSON in power bi when first data is name of columns
ex
{
"fields":
["name_table1", "name_table2", "name_table3"],
"data": [
["d1","d1","d1"],
["d2", "d2", "d2"]
]
}
Hi @Nick_2510 ,
If there are some null values in the dataset, it will generate an error when trying to parse. You can try to replace the empty value with the empty structure "<div></div>", then it will parse and return the empty value correctly
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for the nice challenge. Here is one possible approach.
let
Source = "{ ""fields"":
[""name_table1"", ""name_table2"", ""name_table3""],
""data"": [
[""d1"",""d1"",""d1""],
[""d2"", ""d2"", ""d2""]
]
}",
#"Parsed JSON" = Json.Document(Source),
data = #"Parsed JSON"[data],
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Extracted Values" = Table.TransformColumns(#"Converted to Table", {"Column1", each Text.Combine(List.Transform(_, Text.From), "|"), type text}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Column1", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}, {"Column1.3", type text}}),
Ren = List.Zip({Table.ColumnNames(#"Changed Type"),#"Parsed JSON"[fields]}),
Res = Table.RenameColumns(#"Changed Type",Ren)
in
Res
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".
Hi,
I got an Expression.Error, it must be Text.Type or Binary.Type. But fields=[List], data=[List]
real example - https://drive.google.com/file/d/1OzleprjuacRzFp0cMBlxFESE6ipIJx50/view?usp=sharing
let
Source = Json.Document(File.Contents("C:\Users\voenik\Desktop\ex.json")),
#"Parsed JSON" = Json.Document(Source),
data = #"Parsed JSON"[data],
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Extracted Values" = Table.TransformColumns(#"Converted to Table", {"Column1", each Text.Combine(List.Transform(_, Text.From), "|"), type text}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Column1", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3"}),
#"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}, {"Column1.3", type text}}),
Ren = List.Zip({Table.ColumnNames(#"Changed Type"),#"Parsed JSON"[fields]}),
Res = Table.RenameColumns(#"Changed Type",Ren)
in
Res
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |