encodeToJsonElement

Serializes the given value into an equivalent JsonElement using the given serializer

Throws

if the given value cannot be serialized to JSON