linux 解析json
Posted 会飞の鱼
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 解析json相关的知识,希望对你有一定的参考价值。
epel源
yum install jq
======================
[[email protected] NaHan-master]# curl 127.0.0.1:5000/v2/_catalog|jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 9922 0 --:--:-- --:--:-- --:--:-- 12000
{
"repositories": [
"consul",
"redis"
]
}
======================================
[[email protected] NaHan-master]# curl 127.0.0.1:5000/v2/_catalog|jq .repositories
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 11892 0 --:--:-- --:--:-- --:--:-- 18000
[
"consul",
"redis"
]
[[email protected] NaHan-master]# curl 127.0.0.1:5000/v2/_catalog|jq .repositories
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 4063 0 --:--:-- --:--:-- --:--:-- 4500
[
"consul",
"redis"
]
[[email protected] NaHan-master]# curl 127.0.0.1:5000/v2/_catalog|jq .repositories[0]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 12092 0 --:--:-- --:--:-- --:--:-- 18000
"consul"
[[email protected] NaHan-master]# curl 127.0.0.1:5000/v2/_catalog|jq .repositories[1]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 10332 0 --:--:-- --:--:-- --:--:-- 12000
"redis"
以上是关于linux 解析json的主要内容,如果未能解决你的问题,请参考以下文章