code: protected String getString(final int index, final JSONArray jsonArray) {
      String value = null;
      if(jsonArray != null && index > -1 && jsonArray.length() > index) {
        try {
          Object o = jsonArray.get(index);
          if(o != null) {
            value = o.toString();
          }
        }
        catch(JSONException e) {
          LOGGER.error("Could not get String from JSONObject for index: " + index, e);
        }
      }
      return value;
    }
docs: Check to make sure the JSONObject has the specified key and if so return
  the value as a string. If no key is found "" is returned.
  
  @param index index of the field to fetch from the json array
  @param jsonArray array from which to fetch the value
  
  @return string value corresponding to the index or null if index not found