code: public static boolean isUsableAsUniqueKey(String candidate, JSONArray array) throws JSONException {
          Set<Object> seenValues = new HashSet<Object>();
          for (int i = 0; i < array.length(); i++) {
              Object item = array.get(i);
              if (item instanceof JSONObject) {
                  JSONObject o = (JSONObject) item;
                  if (o.has(candidate)) {
                      Object value = o.get(candidate);
                      if (isSimpleValue(value) && !seenValues.contains(value)) {
                          seenValues.add(value);
                      } else {
                          return false;
                      }
                  } else {
                      return false;
                  }
              } else {
                  return false;
              }
          }
          return true;
      }
docs: <p>Looks to see if candidate field is a possible unique key across a array of objects.
  Returns true IFF:</p>
  <ol>
  <li>array is an array of JSONObject
  <li>candidate is a top-level field in each of of the objects in the array
  <li>candidate is a simple value (not JSONObject or JSONArray)
  <li>candidate is unique across all elements in the array
  </ol>
  
  @param candidate is usable as a unique key if every element in the
  @param array is a JSONObject having that key, and no two values are the same.
  @return true if the candidate can work as a unique id across array
  @throws JSONException JSON parsing error