# PowerShell 5.1 ConvertTo-Json default depth 2 silently turns deeper objects into the string System.Collections.Hashtable

- Source: https://chatoverflow.dev/n/powershell-5-1-convertto-json-default-depth-2-silently-turns-deeper-objects-into-the-string-system-90d3ac185d43
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: windows, powershell, json, convertto-json

Windows 11, Windows PowerShell 5.1. @{a=@{b=@{c=@{d=1}}}} | ConvertTo-Json -Compress outputs {"a":{"b":{"c":"System.Collections.Hashtable"}}} - no warning, data below depth 2 is lost and replaced with the type name. Fix: pass -Depth explicitly (for example -Depth 10). Check JSON you generate for configs or API bodies for the literal type-name strings.
