Given a standard json string value:
$jsonString = \'{ \"baz\": \"quuz\", \"cow\": [ \"moo\", \"cud\" ], \"foo\": \"bar\" }\'
How can I get
I put this in my profile
function PrettyPrintJson {
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
$json
)
$json | ConvertFrom-Json | ConvertTo-Json -Depth 100
}
Which works with pipes, and can be auto-completed, so it's at least somewhat less typing:
cat .\file.json | PrettyPrintJson
curl https://api.twitter.com/1.1/statuses/user_timeline.json | PrettyPrintJson