In Ubuntu you can simply install jq:

apt-get install jq 

But, on Debian it is not in the repository.

Is there an alternative command-line to parse a JSON string on the console?

maybe you can achieve this with python like (fantasycode):

cat test.json | python 'parse_json(stdin)'

8 Answers 8


jq is in Wheezy backports, and slated for Jessie

For backports on Wheezy, add the following to /etc/apt/sources.list (or a file to sources.d/???.list)

deb http://http.debian.net/debian wheezy-backports main


apt-get -t wheezy-backports install jq

Another alternative:

python -m json.tool file.json

One CLI json parser is jshon. Here is a simple example:

$ jshon -e foo -u <<< '{ "foo":"bar" }' 

The -e options extract values from the json and the -u decodes the final string.


also take a look at jtc unix utility - I developed jtc aiming to simply achieving JSON queries drastically:

  • it's objectively faster
  • easier to attain a solution (in most of the cases) - though it's subjective, until you try
  • the base concept is easy to understand
  • typically, jtc idiomatic solutions would be input data omissions resistant and invariant to input data outer structure (as long walking JSON elements retain the same relationship)

jp is one JSON parsing CLI alternative to jq based on the Python library jmespath (a pretty solid tool to depend on, it's notably the default JSON parsing library for the AWS cli).

While the library in question seems to be available on Debian, the jp CLI interface however doesn't seem to be.


As my search for something like this ended me up here twice now.

A working python solution that also supports filtering like:

cat test.json | jq -r .myfield

would be:

cat test.json | python -c 'import json, sys; print(json.dumps(json.loads("".join([l for l in sys.stdin]))["myfield"]))'

I created a cli tool called jello that works similarly to jq but allows you to use pure python code in your filters without all of the JSON loading boilerplate. Also allows you to use dot notation instead of dict bracket notation if you choose.

$ ip -j addr show | jello -lr '\
ips = []
for interface in _:
  for addr in interface.addr_info:



Take a look at fx 🔥

It's plain JavaScript cli JSON manipulating tool (alternative to jq) with standalone binary.

program | fx 'input => input.filter(x => ...).map(x => {a: a.x})'
  • Also not available for Debian from ordinary apt repos.
    – Kusalananda
    Commented May 14 at 8:23

I also ended up here looking for a json command line parser which name I didn't remember :)

Turns out noone mentioned what I was looking for, so let me tell you about jid - the

json incremental digger

  • Please add an example how to install and how to use it. And no need for the first sentence, delete it
    – rubo77
    Commented Sep 3, 2021 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .