All Posts programming Jello: a command-line JSON processor using Python syntax

Jello: a command-line JSON processor using Python syntax

· 223 words · 2 minute read

jello is a command-line JSON processor using Python syntax.

Pretty-print JSON or JSON-Lines data from stdin to stdout:

cat file.json | jello

Output a schema of JSON or JSON Lines data from stdin to stdout (useful for grep):

cat file.json | jello -s

Output all elements from arrays (or all the values from objects) in JSON or JSON-Lines data from stdin to stdout:

cat file.json | jello -l

Output the first element in JSON or JSON-Lines data from stdin to stdout:

cat file.json | jello _[0]

Output the value of a given key of each element in JSON or JSON-Lines data from stdin to stdout:

cat file.json | jello '[i.key_name for i in_]'

Output the value of multiple keys as a new JSON object (assuming the input JSON has the keys key_name1 and key_name2):

cat file.json | jello '{"key1": _.key_name1, "key_name":_.key_name2}'

Output the value of a given key to a string (and disable JSON output):

cat file.json | jello -r '"some text: " + _.key_name'

More information: https://github.com/kellyjonbrazil/jello .

I hope you enjoyed reading this post as much as I enjoyed writing it. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube , Twitter (x) , LinkedIn , and GitHub .