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
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
| Flag | What it does |
|---|---|
| -r | Raw output: strip quotes from string results |
| -l | Lines: print list elements one per line |
| -c | Compact JSON output (no pretty-printing) |
| -n | Print null values in the output |
| -s | Treat 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.