FlattenObjects Parameter (Connect-XML Cmdlet)
Set FlattenObjects to true to flatten object properties into columns of their own. Otherwise, objects nested in arrays are returned as strings of XML.
Syntax
Connect-XML -FlattenObjects bool
Data Type
bool
Default Value
true
Remarks
Set FlattenObjects to true to flatten object properties into columns of their own.
- Object: Any parent element that does not repeat at the same height.
- Array: Any element that repeats at the same height.
For example, you can use this property to flatten the nested objects below at connection time:
<grades> <grade>A</grade> <score>2</score> </grades> <grades> <grade>A</grade> <score>6</score> </grades> <grades> <grade>A</grade> <score>10</score> </grades> <grades> <grade>A</grade> <score>9</score> </grades> <grades> <grade>B</grade> <score>14</score> </grades>To generate the column name, the cmdlet concatenates the property name onto the object name with a dot. When FlattenObjects is set to true and FlattenArrays is set to 1, the preceding array is flattened into the following table:
Column Name | Column Value |
grades.0.grade | A |
grades.0.score | 2 |