Tools
Jq
Inspect and reshape JSON from files and HTTP responses.
Updated Official documentation ↗
Select values
jq '.' response.jsonPretty-print valid JSONjq '.name' response.jsonSelect a propertyjq '.items[]' response.jsonEmit each itemjq -r '.name' response.jsonOutput a string without JSON quotesTransform
jq '.items | map(.id)' response.jsonProduce an array of IDsjq '.items[] | select(.active == true)' response.jsonKeep active itemsjq '{name, id}' response.jsonBuild an object with selected propertiesjq '.items | sort_by(.name)' response.jsonSort an array by a propertyVariables and checks
jq --arg name 'Ada' 'select(.name == $name)' users.jsonPass a string safelyjq -e '.ok == true' response.jsonUse exit status to test a resultjq '.value // "missing"' response.jsonFallback for null or falsejq 'length' response.jsonCount array items or object keys