How To Install Jq In Debian, Ubuntu, Alpine, Arch, Kali, Fedora, Raspbian And MacOS?
Maintainer: ChangZhuo Chen (u9673u660cu502c)
Email: [email protected] .
Website: https://github.com/stedolan/jq
Section: utils
Install jq
-
Debian
apt-get install jqClick to copy -
Ubuntu
apt-get install jqClick to copy -
Alpine OS
apk add jqClick to copy -
Arch Linux
pacman -S jqClick to copy -
Kali Linux
apt-get install jqClick to copy -
Fedora
dnf install jqClick to copy -
Raspbian
apt-get install jqClick to copy -
macOS
brew install jqClick to copy
A lightweight and flexible command-line JSON processor.
How to use jq?
Below are few example commands for jq that you can use in the terminal.
Output a JSON file, in pretty-print format:jq . file.jsonClick to copyOutput all elements from arrays (or all key-value pairs from objects) in a JSON file:jq .[] file.jsonClick to copyRead JSON objects from a file into an array, and output it (inverse of `jq .[]`):jq --slurp . file.jsonClick to copyOutput the first element in a JSON file:jq .[0] file.jsonClick to copyOutput the value of a given key of the first element in a JSON text from stdin:cat file.json | jq .[0].key_nameClick to copyOutput the value of a given key of each element in a JSON text from stdin:cat file.json | jq 'map(.key_name)'Click to copy
Install the latest version of jq in Debian, Ubuntu, Alpine, Arch, Kali, Fedora, Raspbian and macOS from terminal. To install the jq just copy the above command for your OS and run into terminal. After you run the command it will grab the latest version of jq from the respository and install it in your computer/server.




