Json

jq

You can use the jq commandline tool to easily format json output and select a element

curl -q somesite.com/endpoint |jq '.' > /tmp/tmp.json
cat response_1544193548707.json |jq -r '.response.body' > /tmp/page.html

For example when you want to decode content from a json message with base64 you could do the following:

for i in $(cat /tmp/tmp.json | jq '.[].payload'); do echo $i |sed 's/^"//g' |sed 's/"$//g' |base64 -d | jq; done


When you want to combine jq with less its nice to keep the colors so its easier to read the json

cat doc.json | jq -C |less -R