#jq
6 one-liners with this tag.
All one-liners tagged jq
Convert a JSON array to CSV with a header row
$jq -r '(.[0] | keys_unsorted) as $k | $k, (.[] | [.[$k[]]]) | @csv' plugins.json > plugins.csv
Count WordPress plugins by status
$wp plugin list --format=json --path=/var/www/vhosts/example.com/httpdocs | jq -r 'group_by(.status)[] | "\(.[0].status): \(length)"'
Extract a single field from JSON with jq
$jq -r '.require.php' composer.json
Filter a JSON array by a field value
$jq '[.[] | select(.status == "active")]' plugins.json
Get the latest WordPress version from the API
$curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r '.offers[0].version'
Pretty-print JSON with indentation and colors
$jq . composer.json