getRequiredString

fun JsonObject.getRequiredString(resource: Resource, name: String): String

JsonObject.getString takes a default value, when that attribute isn't present. However, sometimes we want to throw an exception when the attribute is missing (because there is no suitable default-value).

Parameters

resource

A debugging aid for extra information in the Exception's message

name

the name of the attribute

Throws

if attribute name is not found.