Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel2
minLevel2


jq

`jq` is a lightweight and flexible command line JSON parser. It supports colored terminal output, and filtering for JSON documents

Code Block
languagebash
# API Call
$ curb -H 'Authorization: xxx' 'https://api.appnexus.com/segment' | jq '.response.segments[] | {id, short_name}'
 
# API Response Example
{
  "id": 1,
  "short_name": "cookie_birthday"
}
{
  "id": 123,
  "short_name": "creative_macro_test_seg"
}
{
  "id": 456,
  "short_name": "In-Market Users"
}

JQ can be downloaded and installed from: https://stedolan.github.io/jq/

json_reformat

|`json_reformat` formats your output nicely without reordering the fields.

...

, and is easily installed via most standard Linux Distros

Code Block
languagebash
 $ curl -b cookies -c cookies 'https://api.appnexus.com/creative' | json_reformat  


If it doesn't work for you, try yum install yajl. If you are using a mac and do not have yum, you can use macports to install json_reformat. Make sure you have xcode and macports downloaded and installed and then run sudo port install yajl. If you get an error message, follow the instructions given.

...