You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bpkg/lib/json
Joseph Werle 16a53e5bcb init 10 years ago
..
test init 10 years ago
.gitignore init 10 years ago
JSON.sh init 10 years ago
LICENSE.APACHE2 init 10 years ago
LICENSE.MIT init 10 years ago
README.md init 10 years ago
all-tests.sh init 10 years ago
package.json init 10 years ago

README.md

JSON.sh

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"]  "JSON.sh"
["version"]  "0.0.0"
["description"]  ""
["homepage"]  "http://github.com/dominictarr/JSON.sh"
["repository","type"]  "git"
["repository","url"]  "https://github.com/dominictarr/JSON.sh.git"
["repository"]  {"type":"git","url":"https://github.com/dominictarr/JSON.sh.git"}
["bin","json_parse"]  "./JSON.sh"
["bin"]  {"json_parse":"./JSON.sh"}
["dependencies"]  {}
#  ... etc

a more complex example:

curl registry.npmjs.org/express | ./JSON.sh | egrep '\["versions","[^"]*"\]'
... try it and see

Options

-b

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

-l

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

-p

Prune empty. Exclude fields with empty values.

-h

Show help text.

Examples

If you have any examples with JSON.sh, streaming twitter, github, or whatever! please issue a pull request and i will include them.

Installation

install via npm or from AUR on archlinux

License

This software is available under the following licenses:

  • MIT
  • Apache 2