toMap

fun JsonElement.toMap(): Map<String, Any?>

Converts this JsonObject element to a Map of string keys to Kotlin values.

Extension function on JsonElement. Primitives become strings, nested objects become nested maps, arrays become lists, and JsonNull becomes null.

Return

a Map representation of this JSON object

Throws

if this element is not a JsonObject