http - curl 格式化输出
一般的, curl 输出json 是一大串,不太美观
JQ
jq常用在从json中解析出过滤出自己想要的属性值、格式化json字符串输出
安装
sudo apt-get install jq
示例:
xiao@z:$ curl http://localhost:8080/services|jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 109 0 109 0 0 21800 0 --:--:-- --:--:-- --:--:-- 21800
{
"boot-product": [
{
"address": "172.23.0.1",
"port": 8081
}
],
"boot-curator": [
{
"address": "172.23.0.1",
"port": 8080
}
]
}