mailoman/json-sh

该软件包最新版本(dev-master)没有可用的许可信息。

用bash编写的JSON解析器

安装: 14

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 0

分支: 267

语言:Shell

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

This package is auto-updated.

Last update: 2024-09-26 04:14:16 UTC


README

嘿,这是一个用bash编写的json解析器

将JSON管道到它,它会遍历JSON对象并打印出当前对象的路径(作为一个JSON数组),然后是对象,没有空格。

$ 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

一个更复杂的示例

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

选项

-b

简短输出。结合了'Leaf only'和'Prune empty'选项。

-l

仅显示叶子节点。仅显示叶子节点,这可以防止数据重复。

-p

剪枝空值。排除具有空值的字段。

-s

移除斜杠(斜杠)的转义。

-h

显示帮助文本。

酷链接

安装

通过npm安装或在archlinux的AUR上安装,或通过composer安装

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

许可

此软件可在以下许可证下使用

  • MIT
  • Apache 2