jq는 커맨드라인 json 프로세서이다.


설치는 brew와 소스 설치(https://github.com/stedolan/jq)가 가능하다.

$ brew install jq



예시1)

$ curl 'http://search.twitter.com/search.json' | jq '.'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   156  100   156    0     0    179      0 --:--:-- --:--:-- --:--:--   179

{

  "errors": [

    {

      "message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.",

      "code": 64

    }

  ]

}



예시2)

트웸프록시의 json 결과 예쁘게 출력하기

$ telnet 127.0.0.1 22222 2> /dev/null | tail -n 1 | jq '.'


{

  "service": "nutcracker",

  "source": "Samuelui-MacBook-Pro.local",

  "version": "0.4.1",

  "uptime": 208,

  "timestamp": 1455010088,

  "total_connections": 7,

  "curr_connections": 5,

  "beta": {

    "client_eof": 0,

    "client_err": 0,

    "client_connecti

....



Posted by '김용환'
,