-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Documentation Issue
PR: PowerShell/PowerShell#11029
Current serialization of IDictionary objects via the CSV cmdlets is very much not useful, as most of the traditional properties can only be flattened to a typename string, so all the data in the dictionaries is lost and all IDictionary entries passed to the CSV cmdlets look more or less identical when serialized in this way.
The linked PR changes this behaviour to ignore standard properties on IDictionary objects, and instead serialize the values contained in the dictionary, using the keys as the property names. It will also allow instance properties (such as those applied with Add-Member) to be serialized along with the dictionary's keys and values, although dictionary entries take precedence. If there is a key with the same name as an instance property, the dictionary entry will always be used instead of the instance property.
All other behaviours of the CSV cmdlets are retained for IDictionary objects, including property discovery behaviour. Only property names/keys on the first input object are inspected, and all subsequent objects are assumed to have the same properties / keys.
Context of the issue
-
URL to the article (Docs or GitHub URL): ConvertTo-Csv / Export-Csv - Serialize IDictionary objects with key/value pairs as properties PowerShell/PowerShell#11029
-
Issue affects the following content (check all that apply):
Cmdlet reference & about_ topics
- Version 7 content
- Version 6 content
- Version 5.1 content
Conceptual articles
- Fundamental conceptual articles
- Script sample articles
- DSC articles
- Gallery articles
- JEA articles
- WMF articles
- SDK articles
-
Is the issue specific to a platform (Y/N - Win/macOS/Linux): No
Detailed description of the issue
Further details are in the linked PR to the PowerShell repo.