From 675c18582c4e892df92d2ad8ecebcc8bd8d8e669 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sat, 12 Jun 2021 07:30:03 -0700 Subject: [PATCH] jello: add page (#6113) * jello: add page add page for jello command (I am the author) https://github.com/kellyjonbrazil/jello * add bash language identifier * add string example * remove mult-line command example that was causing CI failure * Uppercase Python Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com> * move quotation marks Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com> * add bracket at beginning of dictionary * make 'some text` a variable Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com> * update stdin/stdout wording Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com> * Clarify stdin and stdout. Also, change JSON LInes to JSON-Lines * Clarify 'grepable' Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com> Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com> --- pages/common/jello.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pages/common/jello.md diff --git a/pages/common/jello.md b/pages/common/jello.md new file mode 100644 index 000000000..3f1390f3e --- /dev/null +++ b/pages/common/jello.md @@ -0,0 +1,32 @@ +# jello + +> A command-line JSON processor using Python syntax. +> More information: . + +- 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_name` and `other_key_name`): + +`cat {{file.json}} | jello '{"{{my_new_key}}": _.{{key_name}}, "{{my_other_key}}": _.{{other_key_name}}}'` + +- Output the value of a given key to a string (and disable JSON output): + +`cat {{file.json}} | jello -r '"{{some text}}: " + _.{{key_name}}'`