Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi superusers,
I have this JSON file:
"{
\"column_definitions\": [
{
\"Database_RecID\": {
\"type\": \"Numeric\",
\"isNullable\": false,
\"identityColumn\": true
}
},
{
\"Index_Number\": {
\"type\": \"Text\",
\"isNullable\": true,
\"identityColumn\": false
}
},
{
\"Support_Type\": {
\"type\": \"Text\",
\"isNullable\": false,
\"identityColumn\": false
}
}
],
\"row_values\": [
[
12303,
\"32255\",
\"Standard\"
],
[
14273,
\"31475\",
\"Optional\"
]
]
}"
and I am unable to convert it into a table. I can either extract the row values or the column values. Any ideas how to make this work, please?
The required output is:
Thank you!
Solved! Go to Solution.
Hi @kbachova ,
You could save your above code as json file, then try below M code
let
Source = Json.Document(File.Contents("C:\Users\<username>\Desktop\gantt.json")),
#"Parsed JSON" = Json.Document(Source),
#"Converted to Table" = Record.ToTable(#"Parsed JSON"),
#"Transposed Table" = Table.Transpose(#"Converted to Table"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Expanded row_values" = Table.ExpandListColumn(#"Promoted Headers", "row_values"),
#"Extracted Values" = Table.TransformColumns(#"Expanded row_values", {"row_values", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Expanded column_definitions" = Table.ExpandListColumn(#"Extracted Values", "column_definitions"),
#"Added Custom" = Table.AddColumn(#"Expanded column_definitions", "Custom", each Record.FieldNames([column_definitions])),
#"Extracted Values1" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From)), type text}),
#"Removed Columns" = Table.RemoveColumns(#"Extracted Values1",{"column_definitions"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"row_values"}, {{"combine", each Text.Combine([Custom], ","), type text}}),
#"Added Index" = Table.AddIndexColumn(#"Grouped Rows", "Index", 0, 1),
#"Pivoted Column" = Table.Pivot(#"Added Index", List.Distinct(#"Added Index"[combine]), "combine", "row_values"),
#"Demoted Headers" = Table.DemoteHeaders(#"Pivoted Column"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Demoted Headers", "Column2", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column2.1", "Column2.2", "Column2.3"}),
#"Promoted Headers1" = Table.PromoteHeaders(#"Split Column by Delimiter", [PromoteAllScalars=true]),
#"Changed Type2" = Table.TransformColumnTypes(#"Promoted Headers1",{{"Index", Int64.Type}, {"Database_RecID", Int64.Type}, {"Index_Number", Int64.Type}, {"Support_Type", type text}})
in
#"Changed Type2"
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @kbachova ,
You could save your above code as json file, then try below M code
let
Source = Json.Document(File.Contents("C:\Users\<username>\Desktop\gantt.json")),
#"Parsed JSON" = Json.Document(Source),
#"Converted to Table" = Record.ToTable(#"Parsed JSON"),
#"Transposed Table" = Table.Transpose(#"Converted to Table"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Expanded row_values" = Table.ExpandListColumn(#"Promoted Headers", "row_values"),
#"Extracted Values" = Table.TransformColumns(#"Expanded row_values", {"row_values", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
#"Expanded column_definitions" = Table.ExpandListColumn(#"Extracted Values", "column_definitions"),
#"Added Custom" = Table.AddColumn(#"Expanded column_definitions", "Custom", each Record.FieldNames([column_definitions])),
#"Extracted Values1" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From)), type text}),
#"Removed Columns" = Table.RemoveColumns(#"Extracted Values1",{"column_definitions"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"row_values"}, {{"combine", each Text.Combine([Custom], ","), type text}}),
#"Added Index" = Table.AddIndexColumn(#"Grouped Rows", "Index", 0, 1),
#"Pivoted Column" = Table.Pivot(#"Added Index", List.Distinct(#"Added Index"[combine]), "combine", "row_values"),
#"Demoted Headers" = Table.DemoteHeaders(#"Pivoted Column"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Demoted Headers", "Column2", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column2.1", "Column2.2", "Column2.3"}),
#"Promoted Headers1" = Table.PromoteHeaders(#"Split Column by Delimiter", [PromoteAllScalars=true]),
#"Changed Type2" = Table.TransformColumnTypes(#"Promoted Headers1",{{"Index", Int64.Type}, {"Database_RecID", Int64.Type}, {"Index_Number", Int64.Type}, {"Support_Type", type text}})
in
#"Changed Type2"
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
| User | Count |
|---|---|
| 19 | |
| 13 | |
| 9 | |
| 8 | |
| 7 |