Monday 3 May 2021

Install and setup jq

On Linux

sudo apt-get install jq

sudo dnf install jq

sudo zypper install jq

sudo pacman -S jq

 

On Mac

brew install jq

port install jq

 

On FreeBSD

pkg install jq

 

On Solaris

pkgutil -i jq

 

You can directly download jq binaries from below location and add the binary to system path and use.

https://stedolan.github.io/jq/download/

 

You can even built jq binaries from source, go through following link for more details.

https://stedolan.github.io/jq/download/

 

Test setup

Once you install jq in your system, open terminal and execute ‘jq’ command.

$jq
jq - commandline JSON processor [version 1.6]

Usage:	jq [options] <jq filter> [file...]
	jq [options] --args <jq filter> [strings...]
	jq [options] --jsonargs <jq filter> [JSON_TEXTS...]

jq is a tool for processing JSON inputs, applying the given filter to
its JSON text inputs and producing the filter's results as JSON on
standard output.

The simplest filter is ., which copies jq's input to its output
unmodified (except for formatting, but note that IEEE754 is used
for number representation internally, with all that that implies).

For more advanced filters see the jq(1) manpage ("man jq")
and/or https://stedolan.github.io/jq

Example:

	$ echo '{"foo": 0}' | jq .
	{
		"foo": 0
	}

For a listing of options, use jq --help.

 

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment