code: private void understandSchema(String schema) throws JSONException {
  
      JSONObject j1 = new JSONObject(schema);
      JSONArray fields = j1.getJSONArray(FIELDS);
  
      String fieldName;
      String fieldTypeValue;
      Object recName;
  
      for (int k = 0; k < fields.length(); k++) {
        if (fields.get(k) == null) {
          continue;
        }
        JSONObject allEvents = new JSONObject(fields.get(k).toString());
        Object name = allEvents.get(NAME);
        if (name != null) {
          if (name.toString().equalsIgnoreCase(EVENT)) {
            JSONArray allTypeDetails = allEvents.getJSONArray(TYPE);
            for (int i = 0; i < allTypeDetails.length(); i++) {
              JSONObject actual = (JSONObject) allTypeDetails.get(i);
              JSONArray types = actual.getJSONArray(FIELDS);
              Map<String, String> typeDetails = new HashMap<String, String>();
              for (int j = 0; j < types.length(); j++) {
                if (types.getJSONObject(j) == null ) {
                  continue;
                }
                fieldName = types.getJSONObject(j).getString(NAME);
                fieldTypeValue = types.getJSONObject(j).getString(TYPE);
                if ((fieldName != null) && (fieldTypeValue != null)) {
                  typeDetails.put(fieldName, fieldTypeValue);
                }
              }
  
              recName = actual.get(NAME);
              if (recName != null) {
                /* the next statement may throw an IllegalArgumentException if
                 * it finds a new string that's not part of the Hadoop2RecordType enum
                 * that way we know what types of events we are parsing
                 */
                fieldTypes.put(Hadoop2RecordType.valueOf(recName.toString()), typeDetails);
              }
            }
          }
        }
      }
    }
docs: understand the schema so that we can parse the rest of the file
  @throws JSONException