jq

A command-line tool that reads, filters and reshapes JSON data.

In more detail

jq applies a small filter expression to JSON read from its input. The -r flag prints plain strings instead of quoted JSON, which makes it easy to use in shell scripts.

Examples

jq -Rsc 'split("\n") - [""]' versions.txt
kubectl version -o json | jq -r .serverVersion.gitVersion
In AWS: A small command-line program for filtering and reshaping JSON, used to pull one value out of a large document.
jq -n --argjson h 0.0118 '{hour: $h, month: ($h*730), year: ($h*8760)}'
jq -r '.data.result[] | "\(.metric | tostring) \(.value[1])"'

Related terms

Taught in

References

Certification courses