第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

Linux命令行(Console)解析JSON

標(biāo)簽:
Linux

有些Linux服务API返回的数据为JSON数据,但是直接在命令行看,看起来很不方便,都拧巴在一起了,比如这样。

[root@songshucang nginx]# curl http://localhost:8500/v1/catalog/service/xxx[{"ID":"5c82060b-caa6-082c-27ac-4e64d38d35f1","Node":"izwz99ridy7gp33ry7hmfqz","Address":"172.18.177.227","Datacenter":"default","TaggedAddresses":{"lan":"172.18.177.227","wan":"172.18.177.227"},"NodeMeta":{"consul-network-segment":""},"ServiceID":"application-ecs-8090","ServiceName":"songshu-cang","ServiceTags":["songshu"],"ServiceAddress":"172.18.177.227","ServicePort":8090,"ServiceEnableTagOverride":false,"CreateIndex":502,"ModifyIndex":502},{"ID":"5c82060b-caa6-082c-27ac-4e64d38d35f1","Node":"izwz99ridy7gp33ry7hmfqz","Address":"172.18.177.227","Datacenter":"default","TaggedAddresses":{"lan":"172.18.177.227","wan":"172.18.177.227"},"NodeMeta":{"consul-network-segment":""},"ServiceID":"application-ecs-8091","ServiceName":"songshu-cang","ServiceTags":["songshu"],"ServiceAddress":"172.18.177.227","ServicePort":8091,"ServiceEnableTagOverride":false,"CreateIndex":520,"ModifyIndex":520}][root@songshucang nginx]#

不过Linux内置了一些命令,比如jq

[root@songshucang nginx]# yum info jqLoaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name        : jq
Arch        : x86_64
Version     : 1.5Release     : 1.el7
Size        : 351 k
Repo        : installed
From repo   : epel
Summary     : Command-line JSON processor
URL         : http://stedolan.github.io/jq/
License     : MIT and ASL 2.0 and CC-BY and GPLv3
Description : lightweight and flexible command-line JSON processor
            :
            :  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.
            :
            :  It is written in portable C, and it has zero runtime
            :  dependencies.
            :
            :  jq can mangle the data format that you have into the
            :  one that you want with very little effort, and the
            :  program to do so is often shorter and simpler than
            :  you'd expect.

安装与使用jq

sudo yum install jq -y

1000

使用jq

总结

简单的介绍了一个Linux的命令。

點擊查看更多內(nèi)容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
JAVA開發(fā)工程師
手記
粉絲
1.1萬
獲贊與收藏
1545

關(guān)注作者,訂閱最新文章

閱讀免費教程

  • 推薦
  • 評論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機(jī)會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機(jī)會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消