Forum Discussion
Power Query Editor unpack JSON
- Oct 30, 2021
I found this worked. I first created a custom column. Then added this as the custom forumla
=if [response_json.sublist] <> false then Table.ToRecords(Table.FromRecords([response_json.sublist])) else Table.ToRecords( Table.FromRecords({ [option_1 = "null", option_2= "null", option_3= "null"] }) )
DreamDelerium Yes you can. Connect to the table with PQ, Select the column with the JSON code. Tra,nsform, Parse, JSON. Expande fields to new rows. Expend records, OK. Repeat expanding fields and records until all columns contain data only. No M-coding required, just pushing buttons in the correct order.
See attached.
Riny_van_Eekelen To make things a little easier to reproduce the error, I have attached a more concise example of the issue. In this example, the field "sublist" can be:
sublist:[] sublist:[{"option_1":1, "option_2: "aaa", option_3:""}] sublist:false
In this example, if the sublist is "false" then it does not appear that I can parse the entire column.
- DreamDeleriumOct 30, 2021Copper Contributor
I found this worked. I first created a custom column. Then added this as the custom forumla
=if [response_json.sublist] <> false then Table.ToRecords(Table.FromRecords([response_json.sublist])) else Table.ToRecords( Table.FromRecords({ [option_1 = "null", option_2= "null", option_3= "null"] }) )
- jjtaghDec 16, 2021Copper Contributor
DreamDelerium Thanks for taking the time to post your steps here, it's helpful. There doesn't seem to be much out there on parsing messy json data!