Code example for JSONArray

Methods: get, length

0
		assert (reader != null);
		 
		ArrayList<Filter> filters = new ArrayList<Filter>();
		 
		JSONArray filterArray = reader.getJSONArray(JSON_FILTER);
		for (int i = 0, l = filterArray.length(); i < l; i++) {
			 
			// try to get a object 
			Object o = null;
			try { 
				o = filterArray.get(i);
			} catch (JSONException e) {
				Printer.perror("Getting object from filter array."); 
				return null; 
			} 
			 
			// check whether it is a String 
			if (!(o instanceof String)) {
				Printer.perror("Field in filter array is not a String."); 
				return null; 
			}