mac jq for json format

mac jq

# 1, the installation 
BREW install JQ 

# 2, create a file 
echo '{ "name": "Ruby"}'> ./test.json 

# 3, see the 
cat ./test.json | jq.

linux

1、使用jq命令

 $ echo '{"uid":100120,"token":"1fa9fb8004b04f66b7da57393641eddc"}' | jq .
2、使用python -mjson.tool

$ echo '{"msg": "ok", "data": {"list": [{"website": "letv", "url": "http://www.letv.com/ptv/pplay/75420/2.html", "video_id": "1594024"}], "cover": "http://img0.hao123.com/data/1_410778331e67b59a079ce4f802fcb26d"}, "ret": 0}' | python -mjson.tool

 

Guess you like

Origin www.cnblogs.com/stono/p/11564859.html