LinuxCommandLibrary

jello

filters JSON using Python expressions

TLDR

Filter JSON with Python

$ echo '[1,2,3]' | jello '[x*2 for x in _]'
copy
Extract field
$ cat [data.json] | jello '_.name'
copy
Filter array
$ cat [data.json] | jello '[x for x in _ if x["age"] > 30]'
copy
Pretty print
$ cat [data.json] | jello -p
copy
Initialize empty dict
$ jello -i 'result = {}'
copy
Output as lines
$ cat [data.json] | jello -l '_.items'
copy

SYNOPSIS

jello [options] [expression]

DESCRIPTION

jello filters JSON using Python expressions. The input JSON is available as underscore (_) variable.
The tool combines jq-like filtering with Python's full expression power. It handles both JSON and JSON Lines.

PARAMETERS

EXPRESSION

Python expression (input is _).
-p, --pretty
Pretty print output.
-l, --lines
Output JSON lines.
-r, --raw
Raw string output.
-c
Compact output.
-i
Initialize mode.
--help
Display help information.

CAVEATS

Requires Python. Slower than jq for simple tasks. Underscore convention.

HISTORY

jello was created by Kelly Brazil as a Python-based alternative to jq for users more familiar with Python syntax.

SEE ALSO

jq(1), jc(1), python(1), gron(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community