Skip to content
Latchkey

jello: Filter JSON With Python Syntax

jello lets you filter and transform JSON with plain Python expressions, referencing the parsed document as the underscore variable _.

If you already know Python but not jq, jello is the shortcut. It parses stdin into Python objects, binds them to _, evaluates your snippet, and prints the result as JSON.

What it does

jello reads JSON from stdin, exposes it as the variable _ (a dict or list), evaluates the Python expression or script you pass, and serializes the result back to JSON. Any Python that returns a value works, including comprehensions.

Common usage

Terminal
echo '{"a":1,"b":2}' | jello '_["a"]'
cat users.json | jello '[u["name"] for u in _]'
# raw string output (no JSON quotes), one per line
cat users.json | jello -rl '[u["email"] for u in _]'

Options

FlagWhat it does
-rRaw output: strip quotes from string results
-lLines: print list elements one per line
-cCompact JSON output (no pretty-printing)
-nPrint null values in the output
-sTreat the input as a stream of JSON objects

In CI

jello is handy when extraction logic is genuinely Python-shaped (nested comprehensions, string methods). Combine -r and -l to emit a clean list you can loop over in bash. Because it evaluates arbitrary Python, only feed it trusted expressions in a pipeline.

Common errors in CI

A malformed snippet raises the underlying Python error, e.g. "jello: Python Exception: KeyError: 'name'" when a field is missing, or "SyntaxError" for a typo. "jello: JSON Load Exception" (or "Expecting value") means the stdin was not valid JSON. Guard optional fields with _.get("name") to avoid KeyError failing the step.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →