JSONUtils

object JSONUtils

Functions

Link copied to clipboard
fun JSONObject.getStringOrNull(key: String): String?

Returns the value mapped by the specified key as a String, or null if the key is not present.

Link copied to clipboard
fun String.toJSONArray(): JSONArray

Converts the given JSON string representation to a JSONArray object.

Link copied to clipboard
fun String.toJSONObject(): JSONObject

Converts the current string to a JSONObject instance. The string must be a valid JSON; otherwise, an IllegalArgumentException is thrown.