jq

A command line json processor

Interact with the Clipboard

Set the results to the clipboard

echo '{ "hello": "world"}' | jq '.' | Set-ClipBoard

Pretty print the clipboard contents

Get-ClipBoard | jq '.'

Flags

Compress/Minify JSON

Minifies the JSON output

echo '{ "hello": "world"}' | jq -c '.'
echo '{ "hello": "world"}' | jq --compact-output '.'
echo '{ "beta": [ { "omega": 1 } ], "alpha": [ { "omega": 2 } ] }' | jq -c '.'
{"beta":[{"omega":1}],"alpha":[{"omega":2}]}

Slurp

Wraps the input in an array so the filter is applied to the entire collection only once

jq -s '.'
jq --slurp '.'

Show the keys

jq '. |= keys'
echo '{ "beta": [ { "omega": 1 } ], "alpha": [ { "omega": 2 } ] }' | jq '. | keys'
[
  "alpha",
  "beta"
]