Dependant on which version of my json parser you are using -- you can check with: //echo -a $JSONVersion -- the JSON request should look like one of the following, assume the returned body is similar to the following(line breaks added for readability):
Code:
{
  "loyalty":{
    "fan":"aeon",
    "total_points":64,
    "current_points":64,
    "updated_at":"2017-01-12T09:00:00.000Z"
  }
}



v0.2.4x
Code:
alias example {
  JSONOpen -duw points <url>
  JSONUrlMethod points GET
  JSONUrlHeader points x-api-key <api-key-removed>
  ;; These headers are auto-set by the json parser
  ;;   Host: <host-removed>:443
  ;;   Connection: close
  ;; This header isn't needed as you aren't sending any data
  ;;   Content-Type application/x-www-form-urlencoded
  JSONUrlGet points

  echo -a Fan: $JSON(points, loyalty, fan)
  echo -a Total: $JSON(points, loyalty, total_points)
  echo -a Current: $JSON(points, loyalty, current_points)
  echo -a Updated: $JSON(points, loyalty, updated_at)
}


v1.0.x - (Recommended)
Code:
alias example {
  JSONOpen -duw points <url>
  JSONHttpMethod points GET
  JSONHttpHeader points x-api-key <api-key-removed>
  ;; These headers are auto-set by the json parser
  ;;   Host: <host-removed>:443
  ;;   Connection: close
  ;; This header isn't needed as you aren't sending any data
  ;;   Content-Type application/x-www-form-urlencoded
  JSONHttpFetch points

  echo -a Fan: $JSON(points, loyalty, fan).value
  echo -a Total: $JSON(points, loyalty, total_points).value
  echo -a Current: $JSON(points, loyalty, current_points).value
  echo -a Updated: $JSON(points, loyalty, updated_at).value
}



Last edited by FroggieDaFrog; 12/01/17 09:19 PM.