6 examples for jq
# Pipe JSON file to less but keep colored output
jq --color-output . file.json | less -R
# Returns the element at {"levelone": {"leveltwo": }}
cat /tmp/somefile.json | jq '.levelone.leveltwo'
# Returns the length of the element at {"levelone": {"leveltwo": }}
cat /tmp/somefile.json | jq '.levelone.leveltwo | length'
# Returns the number of items in the given array
echo '[{"username":"user1"},{"username":"user2"}]' | jq '. | length'