Forum Discussion
Jeze1
9 months agoFrequent Visitor
New to Power Query
Apologies in advance. I am relatively new to Power Query (and coding) and have spent a couple of days looking at forums/guides/etc, and playing with Power Query. I have a JSON file that I have edite...
- 9 months ago
Jeze1 ,
I mean I built it for your original structure where I expected two items, first is headers, the rest is all rows.
If your JSON will have first row headers and then N number of rows of items, you can do this:let Source = Json.Document(File.Contents("path.json")), headers = List.Transform( Source[Rows]{0}[Cells]?, each [Value] ), listWithRows = List.Range( Source[Rows], 1), getRows = List.Combine( List.Transform(listWithRows, (l1)=> List.Transform(l1[Rows], (l2)=> List.Transform(l2[Cells], (l3)=> l3[Value]))) ), createTable = #table(headers, getRows) in createTable
Since we have one more list, the process is kind of the same, just one level deeper.
Jeze1
9 months agoFrequent Visitor
Thank you so much.
It also gives me a deeper understanding of it too, as I try and work out why you got to that answer.
vojtechsima
9 months agoSuper User
Jeze1 nice, glad to hear that. If you need a more detailed explanation, let me know. Thanks for the kudos.