JSON Formatting & jq Filters
Use deterministic key sorting before diffing configuration snapshots or API responses.
Common Patterns
# Pretty print with sorted keys
jq -S '.' input.json
# Filter array items and export TSV
jq -r '.items[] | select(.active==true) | [.id, .name, .region] | @tsv' data.json
# Compact single-line JSON for logs
jq -c '.' payload.json