Given a standard json string value:
$jsonString = \'{ \"baz\": \"quuz\", \"cow\": [ \"moo\", \"cud\" ], \"foo\": \"bar\" }\'
How can I get
Adding to @JS2010's answer I added logic to escape out certain characters and clean up my output even further. The parenthesis seems key and -depth is a big one since you can lose details without it, from what I've seen, on depth that goes beyond the default of 5, I believe it is.
function Format-Json ($JSON)
{
$PrettifiedJSON = ($JSON) | convertfrom-json | convertto-json -depth 100 | ForEach-Object { [System.Text.RegularExpressions.Regex]::Unescape($_) }
$PrettifiedJSON
}