Search code examples
jsonjqpretty-print

Decompress / decompact JSON using jq


I can compact JSON using jq -c like so:

cat file.json | jq -c 

which will output all the json on a single line..is there a command that can decompact/decompress it so it's more human readable again? Basically adding newlines in the right places?


Solution

  • . is the basic JQ filter (jq by default pretty-prints all output)

    cat file.json | jq -c | jq .

    jq . will decompress it