intValueOrNull

fun JsonElement.intValueOrNull(vararg keys: String): Int?

Navigates to the nested element at keys and returns its integer value, or null if it is missing, JSON null, or not an integer. Extension function on JsonElement.