getOptionalString

fun JSONObject.getOptionalString(key: String?): String?

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