命令行工具,用于验证和漂亮地打印json(仅用于“json.tool”中缺少的选项)
prettyjson的Python项目详细描述
漂亮的json
打印漂亮json的工具(仅用于json.tool
中缺少的选项)
对于Python bug tracker中的问题:
安装
使用pip
:
pip install -U prettyjson
用法示例
示例1
echo'{"name": "vimfun", "from": "The Earth"}'| python -m prettyjson
结果:
{"name":"vimfun","from":"The Earth",}
示例2
echo'{"name": "vimfun", "from": "The Earth"}'| python -m prettyjson --indent=2
结果:
{"name":"vimfun","from":"The Earth"}
示例3
echo'{"name": "王旭林", "from": "The Earth"}'| python -m prettyjson --indent=2 --no-ensure-ascii
结果:
{"name":"王旭林","from":"The Earth"}
链接
测试状态: