6 examples for jq

{{ score }}
  # Pipe JSON file to less but keep colored output
jq --color-output . file.json | less -R
        
{{ score }}
  # Read a gzipped JSON file
gzip -d -c file.json.gz | jq .
        
{{ score }}
  # Returns the element at {"levelone": {"leveltwo": }}
cat /tmp/somefile.json | jq '.levelone.leveltwo'
        
{{ score }}
  # Returns the length of the element at {"levelone": {"leveltwo": }}
cat /tmp/somefile.json | jq '.levelone.leveltwo | length'
        
{{ score }}
  # Print strings without quotes (raw output)
echo '{"search":"jq!"}' | jq -r .search
        
{{ score }}
  # Returns the number of items in the given array
echo '[{"username":"user1"},{"username":"user2"}]' | jq '. | length'