Skip to content
a pipeable JSON parser written in Bash
Find file
Latest commit 2afb061 @dominictarr Merge pull request #41 from decibel/test_ls
Fix format of test output header (remove spaces)

yo, so it's a json parser written in bash

pipe json to it, and it traverses the json objects and prints out the path to the current object (as a JSON array) and then the object, without whitespace.

$ json_parse < package.json
["name"]  ""
["version"]  "0.0.0"
["description"]  ""
["homepage"]  ""
["repository","type"]  "git"
["repository","url"]  ""
["repository"]  {"type":"git","url":""}
["bin","json_parse"]  "./"
["bin"]  {"json_parse":"./"}
["dependencies"]  {}
#  ... etc

a more complex example:

curl | ./ | egrep '\["versions","[^"]*"\]'
... try it and see



Brief output. Combines 'Leaf only' and 'Prune empty' options.


Leaf only. Only show leaf nodes, which stops data duplication.


Prune empty. Exclude fields with empty values.


No-head. Don't show nodes that have no path. Normally these output a leading '[]', which you can't use in a bash array.


Remove escaping of the solidus symbol (stright slash).


Show help text.

Cool Links


install via npm or from AUR on archlinux


This software is available under the following licenses:

  • MIT
  • Apache 2
Something went wrong with that request. Please try again.