只是一个对json文件中的键进行排序的小工具
json-sort的Python项目详细描述
json排序
只是一个对json文件中的键进行排序的小工具
快速启动
首先,使用 pip:
sh-4.2$ pip install json-sort
接下来,使用json-sort-fromfile
或json-sort-fromremote
:
sh-4.2$ json-sort-fromremote http://headers.jsontest.com/ { "Accept": "application/json", "Content-Type": "application/json", "Host": "headers.jsontest.com", "User-Agent": "python-requests/2.10.0", "X-Cloud-Trace-Context": "8de3c28b6c503d26d38c1c7d6111bfa6/11298559371430510765" }
参数
要查看二进制文件的用法,只需设置-h
:
usage: json-sort-fromfile [-h] [--output FILE] [--verbose] file positional arguments: file input file optional arguments: -h, --help show this help message and exit --output FILE, -o FILE output file (default: stdout) --verbose increase output verbosity
示例:
sh-4.2$ json-sort-fromfile --verbose --output test2.json ../test.json DEBUG : Checking file: /tmp/test.json DEBUG : Saving to: /tmp/json-sort/test2.json
许可证
apache许可证2.0