json_pp
(git-bash内置的用于JSON格式化的管道工具;默认支持)
(Linux CentOS7 暂不支持)
curl http://localhost:8080/xxxx.json | json_pp
root# echo '{"uid":100120,"token":"1fa9fb8004b04f66b7da57393641eddc"}' | json_pp
{
"uid" : 100120,
"token" : "1fa9fb8004b04f66b7da57393641eddc"
}
root# echo '{"uid":100120,"token":"1fa9fb8004b04f66b7da57393641eddc"}' | json_pp .
{
"token" : "1fa9fb8004b04f66b7da57393641eddc",
"uid" : 100120
}
jq
(Linux CentOS/Ubuntu 支持,但需主动安装;默认不支持)
(git-bash暂不支持)
- 安装
[CentOS]
root# yum -y install jq
[Ubuntu]
root# apt-get update
root# apt-get -y install jq
- 使用
root# echo '{"uid":100120,"token":"1fa9fb8004b04f66b7da57393641eddc"}' | jq .
{
"uid": 100120,
"token": "1fa9fb8004b04f66b7da57393641eddc"
}