encode

abstract fun <T : Any> encode(value: T, type: Type? = null): String(source)

Encode value into a JSON string.

Return

The JSON string representation.

Parameters

value

The value to serialize.

type

Optional Type token for generic types. When null, the serializer should use the runtime class of value.