mailoman/json-sh

There is no license information available for the latest version (dev-master) of this package.

JSON parser written in bash

Installs: 14

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 270

Language:Shell

dev-master 2015-06-04 04:17 UTC

This package is auto-updated.

Last update: 2024-04-26 03:24:06 UTC


README

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.

-s

Remove escaping of the solidus symbol (stright slash).

-h

Show help text.

Cool Links

Installation

install via npm or from AUR on archlinux or via composer

  • npm install -g JSON.sh
  • yaourt -Sy json-sh (json-sh on aur thanks to kremlin-)
  • composer.phar require 'mailoman/json-sh:dev-master'

License

This software is available under the following licenses:

  • MIT
  • Apache 2