src/org/ohmage/domain/campaign/RepeatableSet.java
@Override
	public JSONObject toJson() throws JSONException {
		JSONObject result = super.toJson();
		
		result.put(JSON_KEY_TERMINATION_QUESTION, terminationQuestion);
		result.put(JSON_KEY_TERMINATION_TRUE_LABEL, terminationTrueLabel);
		result.put(JSON_KEY_TERMINATION_FALSE_LABEL, terminationFalseLabel);
		result.put(JSON_KEY_TERMINATION_SKIP_ENABLED, terminationSkipEnabled);
		result.put(JSON_KEY_TERMINATION_SKIP_LABEL, terminationSkipLabel);
		
		List<Integer> indices = new ArrayList<Integer>(surveyItems.keySet());
		Collections.sort(indices);
		
		JSONArray surveyItemsJson = new JSONArray();
		for(Integer index : indices) {
			surveyItemsJson.put(surveyItems.get(index).toJson());
		}
		result.put(JSON_KEY_PROMPTS, surveyItemsJson);
		
		return result;
	}
/**
	 * Creates a JSONObject that represents this repeatable set and all of its
	 * survey items.
	 * 
	 * @return A JSONObject representing this repeatable set and it survey 
	 * 		   items or null if there is an error.
	 * 
	 * @throws JSONException There was an error creating the JSONObject.
	 */
Creates a JSONObject that represents this repeatable set and all of its
survey items.

@return A JSONObject representing this repeatable set and it survey
items or null if there is an error.

@throws JSONException There was an error creating the JSONObject.
Creates a JSONObject that represents this repeatable set and all of its survey items . @return A JSONObject representing this repeatable set and it survey items or null if there is an error . @throws JSONException There was an error creating the JSONObject .
@Override
	public JSONObject toJson() throws JSONException {
		JSONObject result = super.toJson();
		result.put(JSON_KEY_TERMINATION_QUESTION, terminationQuestion);
		result.put(JSON_KEY_TERMINATION_TRUE_LABEL, terminationTrueLabel);
		result.put(JSON_KEY_TERMINATION_FALSE_LABEL, terminationFalseLabel);
		result.put(JSON_KEY_TERMINATION_SKIP_ENABLED, terminationSkipEnabled);
		result.put(JSON_KEY_TERMINATION_SKIP_LABEL, terminationSkipLabel);
		List<Integer> indices = new ArrayList<Integer>(surveyItems.keySet());
		Collections.sort(indices);
		JSONArray surveyItemsJson = new JSONArray();
		for(Integer index : indices) {
			surveyItemsJson.put(surveyItems.get(index).toJson());
		}
		result.put(JSON_KEY_PROMPTS, surveyItemsJson);
		return result;
	}
@ Override public JSONObject toJson ( ) throws JSONException { JSONObject result = super . toJson ( ) ; result . put ( JSON_KEY_TERMINATION_QUESTION , terminationQuestion ) ; result . put ( JSON_KEY_TERMINATION_TRUE_LABEL , terminationTrueLabel ) ; result . put ( JSON_KEY_TERMINATION_FALSE_LABEL , terminationFalseLabel ) ; result . put ( JSON_KEY_TERMINATION_SKIP_ENABLED , terminationSkipEnabled ) ; result . put ( JSON_KEY_TERMINATION_SKIP_LABEL , terminationSkipLabel ) ; List < Integer > indices = new ArrayList < Integer > ( surveyItems . keySet ( ) ) ; Collections . sort ( indices ) ; JSONArray surveyItemsJson = new JSONArray ( ) ; for ( Integer index : indices ) { surveyItemsJson . put ( surveyItems . get ( index ) . toJson ( ) ) ; } result . put ( JSON_KEY_PROMPTS , surveyItemsJson ) ; return result ; }
Creates a JSONObject that represents this repeatable set and all of its
 survey items.
Creates a JSONObject that represents this repeatable set and all of its survey items .