Forum Discussion
Anonymous
5 years agoNot applicable
Automatically expand record columns ?
I am getting a JSON response from a web source that I convert into a table and then execute Table.ExpandRecordColumn. example: "metaData": { "A": "1", "B": "2", ...
- 5 years ago
Depending on if you have a Table or a Record in your JSON response, you can use the Table.ColumnNames or Record.FieldNames functions to dynamically return the Column/Field names as a List you can then use in your Table.ExpandColumns functions (to replace the List of hardcoded names).
Pat
mahoneypat
5 years agoMicrosoft Employee
Depending on if you have a Table or a Record in your JSON response, you can use the Table.ColumnNames or Record.FieldNames functions to dynamically return the Column/Field names as a List you can then use in your Table.ExpandColumns functions (to replace the List of hardcoded names).
Pat
Anonymous
5 years agoNot applicable
I figured out that the following code works
Table.ExpandRecordColumn(
#"Table From Previous Step",
"metaData",
//Return Field Names
Record.FieldNames(
//Combine the records
Record.Combine(
//Select items in list which are not null, and return a list
List.Select(
//Get a list for the metaData column
Table.Column(
#"Table From Previous Step", "metaData"
),
(x) => x <> null
)
)
)
),
, and performance seems to be OK