Forum Discussion
Anonymous
5 years agoNot applicable
Flattening an 'n' level JSON file
Hi, I'm trying to turn an (theoretically) infinitely nested JSON into a table, similar to the below. I'm not sure where to start as the moment PowerQuery reads it as a JSON I'm doomed to recu...
mahoneypat
Microsoft Employee
5 years agoSince you only provided an image and not the json file, I couldn't try this out directly, but you should be able to do the following
- in the query editor, connect to the file as text instead of json
- use Text.Select to keep just numbers, letters and ":"
- filter out the rows that aren't your 8 repeating value pairs (account, project, type, etc.)
- split the column at the ":"
- add a column that creates an "index" with repeats of 8 (1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3 ...)
- pivot the data to get your desired result
Regards,
Pat