Buggy code:
break ; case "user_type" : mendeleyProfile . setUserType ( profileObject . getString ( key ) ) ; break ; case "url" : mendeleyProfile . setUrl ( profileObject . getString ( key ) ) ; break ; case "email" : mendeleyProfile . setEmail ( profileObject . getString ( key ) ) ; break ; case "link" : mendeleyProfile . setLink ( profileObject . getString ( key ) ) ; break ; case "first_name" : mendeleyProfile . setFirstName ( profileObject . getString ( key ) ) ; break ; case "last_name" : mendeleyProfile . setLastName ( profileObject . getString ( key ) ) ; break ; case "research_interests" : mendeleyProfile . setResearchInterests ( profileObject . getString ( key ) ) ; break ; case "academic_status" : mendeleyProfile . setAcademicStatus ( profileObject . getString ( key ) ) ; break ; case "verified" : mendeleyProfile . setVerified ( profileObject . getBoolean ( key ) ) ; break ; case "created_at" : mendeleyProfile . setCreatedAt ( profileObject . getString ( key ) ) ; break ; case "discipline" : JSONObject disciplineObject = profileObject . getJSONObject ( key ) ; Discipline discipline = new Discipline ( ) ; if ( disciplineObject . has ( "name" ) ) { discipline . name = disciplineObject . getString ( "name" ) ; } mendeleyProfile . setDiscipline ( discipline ) ; break ; case "photo" : JSONObject photoObject = profileObject . getJSONObject ( key ) ; Photo photo = null ; if ( photoObject . has ( "square" ) ) { photo = new Photo ( photoObject . getString ( "square" ) ) ; } mendeleyProfile . setPhoto ( photo ) ; break ; case "education" : JSONArray educationArray = profileObject . getJSONArray ( key ) ; ArrayList < Education > educationList = new ArrayList < Education > ( ) ; for ( int i = 0 ; i < ( educationArray . length ( ) ) ; i ++ ) { JSONObject educationObject = educationArray . getJSONObject ( i ) ; Education . Builder education = new Education . Builder ( ) ; for ( @ SuppressWarnings ( "unchecked" ) Iterator < String > educationIter = educationObject . keys ( ) ; educationIter . hasNext ( ) ; ) { String educationKey = educationIter . next ( ) ; switch ( educationKey ) { case "id" : education . setId ( educationObject . getInt ( educationKey ) ) ; break ; case "last_modified" : education . setLastModified ( educationObject . getString ( educationKey ) ) ; break ; case "created" : education . setCreated ( educationObject . getString ( educationKey ) ) ; break ; case "degree" : education . setDegree ( educationObject . getString ( educationKey ) ) ; break ; case "institution" : education . setInstitution ( educationObject . getString ( educationKey ) ) ; break ; case "start_date" : education . setStartDate ( educationObject . getString ( educationKey ) ) ; break ; case "end_date" : education . setEndDate ( educationObject . getString ( educationKey ) ) ; break ; case "website" : education . setWebsite ( educationObject . getString ( educationKey ) ) ; break ; } } educationList . add ( education . build ( ) ) ; } mendeleyProfile . setEducation ( educationList ) ; break ; case "employment" : JSONArray employmentArray = profileObject . getJSONArray ( key ) ; ArrayList < Employment > employmentList = new ArrayList < Employment > ( ) ; for ( int i = 0 ; i < ( employmentArray . length ( ) ) ; i ++ ) { JSONObject employmentObject = employmentArray . getJSONObject ( i ) ; Employment employment = new Employment ( ) ; for ( @ SuppressWarnings ( "unchecked" ) Iterator < String > employmentIter = employmentObject . keys ( ) ; employmentIter . hasNext ( ) ; ) { String employmentKey = employmentIter . next ( ) ; switch ( employmentKey ) { case "id" : employment . id = employmentObject . getInt ( employmentKey ) ; break ; case "last_modified" : employment . lastModified = employmentObject . getString ( employmentKey ) ; break ; case "position" : employment . position = employmentObject . getString ( employmentKey ) ; break ; case "created" : employment . created = employmentObject . getString ( employmentKey ) ; break ; case "institution" : employment . institution = employmentObject . getString ( employmentKey ) ; break ; case "start_date" : employment . startDate = employmentObject . getString ( employmentKey ) ; break ; case "end_date" : employment . endDate = employmentObject . getString ( employmentKey ) ; break ; case "website" : employment . website = employmentObject . getString ( employmentKey ) ; break ; case "is_main_employment" : employment . isMainEmployment = employmentObject . getBoolean ( employmentKey ) ; break ; case "classes" : <START_BUG> JSONArray classesArray = employmentObject . getJSONArray ( key ) ; <END_BUG> for ( int j = 0 ; j < ( classesArray . length ( ) ) ; j ++ ) { employment . classes . add ( classesArray . getString ( j ) ) ; } break ; } } employmentList . add ( employment ) ; } mendeleyProfile . setEmployment ( employmentList ) ; break ; } } return mendeleyProfile . build ( ) ; } public static Group parseGroup ( String jsonString ) throws JSONException { } public static Document parseDocument ( String jsonString ) throws JSONException { } public static List < File > parseFileList ( String jsonString ) throws JSONException { } public static List < Document > parseDocumentList ( String jsonString ) throws JSONException { } public static List < Annotation > parseAnnotationList ( String jsonString ) throws JSONException { } public static List < UserRole > parseUserRoleList ( String jsonString ) throws JSONException { } public static List < Group > parseGroupList ( String jsonString ) throws JSONException { } public static String getJsonString ( InputStream stream ) throws IOException { } }

Fix:
JSONArray classesArray = employmentObject . getJSONArray ( employmentKey ) ;