JSON command line formatter tool for Linux

是否有用于Linux命令行的编辑器或工具来格式化JSON数据?


 alias pp='python -mjson.tool'
 pp mydata.json

从接受答案中的第一个链接:http://ruslanspivak.com/2010/10/12/pretty-print-json-from-the-command-line/


jq is a lightweight and flexible command-line JSON processor.

http://stedolan.github.io/jq/

jq is like sed for JSON data – you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.

jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine, and expect it to work.


On Ubuntu jsonlint is provided by apt:python-demjson

Usage:

$ sudo apt-get install python-demjson
$ jsonlint -f input.json > output.json
链接地址: http://www.djcxy.com/p/8268.html

上一篇: 如何通过jQuery Ajax发布数据在PHP中对JSON进行编码?

下一篇: 适用于Linux的JSON命令行格式化工具