2011-12-03 53 views
1

我已經做了一個捲曲的請求和波紋管得到的迴應:如何從shell腳本獲取字典值?

$ curl -s http://xx.com/api 
$ {"key":"value"} 

我怎麼能直接從該請求獲得的價值?就像這樣:

$ curl -s http://xx.com/api | XXXX 
$ value 
+0

你或許應該看看這個問題:http://stackoverflow.com/questions/3919750/parse-json-with-shell-scripting-at-linux – Hobblin

回答

1
curl -s http://xx.com/api | sed 's/.*:"\(.*\)".*/\1/' 
+0

感謝DejanLekic,它作品! – fannheyward