I\'m having a problem with ConvertTo-Json and was trying to understand the behavior and/or what I\'m doing wrong.
Consider this sequence of commands:
-Depth $([int32]::MaxValue)
specifies infinite depth (maximum possible for ConvertTo-Json cmdlet)
It's a trouble with the depth, the default value is 2, can you try :
ConvertTo-json @($val) -Depth 5