Code example for JsonPrimitive

Methods: isBooleanisString

0
		else 
			return handleObject(json.getAsJsonObject(), context);
	} 
 
	private Object handlePrimitive(JsonPrimitive json) {
		if (json.isBoolean())
			return json.getAsBoolean();
		else if (json.isString())
			return json.getAsString();
		else { 
			BigDecimal bigDec = json.getAsBigDecimal();
			// Find out if it is an int type 
			try { 
				bigDec.toBigIntegerExact();
				try { 
					return bigDec.intValueExact();
				} catch (ArithmeticException e) {
				} 
				return bigDec.longValue();
			} catch (ArithmeticException e) {
Experience pair programming with AI  Get Codota for Java