getDoubleOrNull

fun JSONObject.getDoubleOrNull(key: String?): Double?

Return

the Double value for key, or null if the key is not mapped in the object.