Parsing a JSON file - NYT API

Hey all,

I am trying to use the NYT api following this tutorial http://blog.blprnt.com/blog/blprnt/processing-json-the-new-york-times

It seems that when i try to grab the total from the array it says it cannot be found, any ideas as wtp why?

import org.json.JSONException;

String apiKey ="4lASP4sV0QO82ITouhBX5mYXSKkH1gNK";

String baseURL = "https://api.nytimes.com/svc/search/v2/articlesearch.json";

void setup() {
  getOJArticles();
};

void getOJArticles() {

String request = baseURL + "?query=O.J.+Simpson&begin_date=19940101&end_date=19960101&api-key=" + apiKey;

String result = join( loadStrings( request ), "");

try{
  JSONObject nytData = loadJSONObject(request);
  JSONArray results = nytData.getJSONArray("results");
  int total = nytData.getInt("total");
  println("There were "+total+" occurences of the term O.J Simpson in 1994-1995");
} finally {}

};