jq

jq is a command line tool that you can use it to slice and filter and map and transform JSON.

Created: by Pradeep Gowda Updated: Apr 28, 2024 Tagged: json

asciicast



Associated programs

gron

gron - “make JSON greppable”. brew install gron

▶ **gron** "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author"
json[0].commit.author = {};
json[0].commit.author.date = "2016-07-02T10:51:21Z";
json[0].commit.author.email = "mail@tomnomnom.com";
json[0].commit.author.name = "Tom Hudson";

Jo

See also: jo, a tool to write JSON in the shell. Example usage:

$ jo -p name=jo n=17 parser=false
{
    "name": "jo",
    "n": 17,
    "parser": false
}

jc

2020-06-01: https://github.com/kellyjonbrazil/jc This tool converts the output of popular command-line tools and file-types to JSON. This allows piping of output to tools like jq.

Example:

$ ls -l /usr/bin | jc --ls | jq '.[] | select(.size > 50000000)'
{
  "filename": "docker",
  "flags": "-rwxr-xr-x",
  "links": 1,
  "owner": "root",
  "group": "root",
  "size": 68677120,
  "date": "Aug 14 19:41"
}

jtbl

2020-06-01: https://github.com/kellyjonbrazil/jtbl – A simple cli tool to print JSON and JSON Lines data as a table in the terminal

Example:

$  cat cities.json | jtbl
  LatD    LatM    LatS  NS      LonD    LonM    LonS  EW    City               State
------  ------  ------  ----  ------  ------  ------  ----  -----------------  -------
    41       5      59  N         80      39       0  W     Youngstown         OH
    42      52      48  N         97      23      23  W     Yankton            SD
    46      35      59  N        120      30      36  W     Yakima             WA
    42      16      12  N         71      48       0  W     Worcester          MA

jello - Filter JSON and JSON Lines data with Python syntax

2020-06-01: jello

jid - json incremental digger

2020-06-05: simeji/jid

jj - JSON Stream editor

2023-05-26: tidwall/jj)

fq - jq for binary formats

2023-06-03: wader/fq: jq for binary formats - tool, language and decoders for working with binary and text formats It was originally designed to query, inspect and debug media codecs and containers like mp4, flac, mp3, jpeg. But has since then been extended to support a variety of formats like executables, packet captures (with TCP reassembly) and serialization formats like JSON, YAML, XML, ASN1 BER, Avro, CBOR, protobuf. In addition it also has functions to work with URL:s, convert to/from hex, number bases, search for things etc.

jaq

jaq aims to support a large subset of jq’s syntax and operations.

Goals: 1. Correctness 2. Performance 3. Simplicity

faq

jzelinskie/faq: Format Agnostic jQ

faq is a tool intended to be a more flexible “jq”, supporting additional formats. The additional formats are converted into JSON and processed with libjq. Supported formats: BSON, Bencode, JSON, TOML, XML, YAML.

jf

2024-04-28 say4n/jf: flatten them json

$ jf -f foo.json
{"foo.bar.0":"baz"}

$ jf --filename foo.json
{"foo.bar.0":"baz"}

$ echo '{"foo": {"bar": ["baz"]}}' | jf
{"foo.bar.0":"baz"}

See also

cube2222/jql: Easy JSON Query Processor with a Lispy syntax in Go


glomRestructuring data, the Python way.

from glom import glom

target = {'a': {'b': {'c': 'd'}}}
glom(target, 'a.b.c')  # returns 'd'

The Zed Project | Zed


Ecosystem of jq adjacent tools.