optString

open fun optString(obj: JSONObject, key: String): String

Return null if obj doesn't have key or if obj has null for key JSONObject.optString(key, fallback) returns the string "null" if object has null for key and null if object doesn't have key

Return

Parameters

obj
key

Throws


open fun optString(obj: JSONObject, key: String, fallback: String): String

Return the fallback if obj doesn't have key or if obj has null for key JSONObject.optString(key, fallback) returns the string "null" if object has null for key and null is object doesn't have key

Return

Parameters

obj
key
fallback

Throws