public static void testValidity(Object o) throws JSONException {
		if(o != null) {
			if(o instanceof Double) {
				if(((Double) o).isInfinite() || ((Double) o).isNaN()) {
					throw new JSONException(
							"JSON does not allow non-finite numbers.");
				}
			} else if(o instanceof Float) {
				if(((Float) o).isInfinite() || ((Float) o).isNaN()) {
					throw new JSONException(
							"JSON does not allow non-finite numbers.");
				}
			}
		}
	}