一行python的json处理器
jqp的Python项目详细描述
JQP
jqp是一个带有python一行程序的json处理器。
要求
- python 2.7、3.3、3.4、3.5
安装
$ pip install jqp
使用量
jqp将每一行解析为json对象,并计算给定的表达式。 解析的json对象被一个名为j的变量绑定。
jqp cmd
cmd: | An expression to evaluate. |
---|
- 可选参数:
-h, --help show this help message and exit --version show version and exit --import IMPORT modules to import --ascii-output, -a with this option, jqp ensures ASCII output --sort-keys, -S sort keys in objects when the command print it --raw-input, -R pass each line text as a string instead of parsing it as JSON --raw-output, -r when a result is string, the command shows a raw string --join-output, -j do not show newlines
示例
% echo '{"name": "Taro", "age": 10}' | jqp '[j["name"], j["age"]]' ["Taro", 10]
许可证
麻省理工学院许可证