-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-utilityArea - Microsoft.PowerShell.Utility moduleArea - Microsoft.PowerShell.Utility module
Milestone
Description
Summary of the new document or enhancement
Add to notes section
- List of articles that need to be updated: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertto-json?view=powershell-7.2
- New articles that need to be created:
- Link(s) to related code PR(s) in the PowerShell/PowerShell repo: Emit warning if
ConvertTo-Jsonexceeds-Depthvalue PowerShell/PowerShell#13692 - Link(s) to related issue(s) in the PowerShell/PowerShell repo: Consider removing the default -Depth value from ConvertTo-Json PowerShell/PowerShell#8393
Description of what changed
When using ConvertTo-Json, the default -Depth value is 2 to avoid recursion for objects like Services on Windows. Users who do not set a deep enough depth may be losing data they may not be aware of as they expected full fidelity of the object to be serialized to JSON. The change agreed by @PowerShell/powershell-committee is to emit a warning message once the depth is exceeded. The warning is only emitted once per object serialized, but note that arrays are treated as a single object and not unrolled.
Metadata
Metadata
Assignees
Labels
area-utilityArea - Microsoft.PowerShell.Utility moduleArea - Microsoft.PowerShell.Utility module