src/org/ohmage/request/user/UserReadRequest.java
@Override
	public void respond(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
		JSONObject metadata = new JSONObject();
		JSONObject jsonResult = new JSONObject();
		
		try {
			metadata.put(JSON_KEY_TOTAL_NUM_RESULTS, numResults);
			
			for(UserInformation userInformation : results) {
				JSONObject currResult = userInformation.toJson(false, false);
				
				UserPersonal personalInformation = 
						userInformation.getPersonalInfo();
				if(personalInformation != null) {
					JSONObject personalJson = 
							personalInformation.toJsonObject();
					
					@SuppressWarnings("unchecked")
					Iterator<String> personalJsonIter = personalJson.keys();
					while(personalJsonIter.hasNext()) {
						String currKey = personalJsonIter.next();
						
						currResult.put(currKey, personalJson.get(currKey));
					}
				}
				
				jsonResult.put(userInformation.getUsername(), currResult);
			}
		}
		catch(JSONException e) {
			LOGGER.error("There was an error building the respons object.");
			setFailed();
		}
		super.respond(httpRequest, httpResponse, metadata, jsonResult);
	}
/**
	 * Creates a JSONObject from the result object and responds with that 
	 * object.
	 */
Creates a JSONObject from the result object and responds with that
object.
Creates a JSONObject from the result object and responds with that object .
@Override
	public void respond(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
		JSONObject metadata = new JSONObject();
		JSONObject jsonResult = new JSONObject();
		try {
			metadata.put(JSON_KEY_TOTAL_NUM_RESULTS, numResults);
			for(UserInformation userInformation : results) {
				JSONObject currResult = userInformation.toJson(false, false);
				UserPersonal personalInformation = 
						userInformation.getPersonalInfo();
				if(personalInformation != null) {
					JSONObject personalJson = 
							personalInformation.toJsonObject();
					@SuppressWarnings("unchecked")
					Iterator<String> personalJsonIter = personalJson.keys();
					while(personalJsonIter.hasNext()) {
						String currKey = personalJsonIter.next();
						currResult.put(currKey, personalJson.get(currKey));
					}
				}
				jsonResult.put(userInformation.getUsername(), currResult);
			}
		}
		catch(JSONException e) {
			LOGGER.error("There was an error building the respons object.");
			setFailed();
		}
		super.respond(httpRequest, httpResponse, metadata, jsonResult);
	}
@ Override public void respond ( HttpServletRequest httpRequest , HttpServletResponse httpResponse ) { JSONObject metadata = new JSONObject ( ) ; JSONObject jsonResult = new JSONObject ( ) ; try { metadata . put ( JSON_KEY_TOTAL_NUM_RESULTS , numResults ) ; for ( UserInformation userInformation : results ) { JSONObject currResult = userInformation . toJson ( false , false ) ; UserPersonal personalInformation = userInformation . getPersonalInfo ( ) ; if ( personalInformation != null ) { JSONObject personalJson = personalInformation . toJsonObject ( ) ; @ SuppressWarnings ( "unchecked" ) Iterator < String > personalJsonIter = personalJson . keys ( ) ; while ( personalJsonIter . hasNext ( ) ) { String currKey = personalJsonIter . next ( ) ; currResult . put ( currKey , personalJson . get ( currKey ) ) ; } } jsonResult . put ( userInformation . getUsername ( ) , currResult ) ; } } catch ( JSONException e ) { LOGGER . error ( "There was an error building the respons object." ) ; setFailed ( ) ; } super . respond ( httpRequest , httpResponse , metadata , jsonResult ) ; }
Creates a JSONObject from the result object and responds with that
 object.
Creates a JSONObject from the result object and responds with that object .