serialize

abstract suspend fun serialize(contentType: ContentType, charset: Charset, typeInfo: TypeInfo, value: Any): OutgoingContent?

Serializes a value to the specified contentType to a OutgoingContent. This function could ignore value if it is not suitable for conversion and return null so in this case other registered converters could be tried or this function could be invoked with other content types it the converted has been registered multiple times with different content types

Return

a converted OutgoingContent value, or null if value isn't suitable for this converter

Parameters

charset

response charset

typeInfo

response body typeInfo

contentType

to which this data converter has been registered and that matches the client's Accept header

value

to be converted