ProblemJsonConverter

Reads and writes application/problem+json bodies for ContentNegotiation.

Thin by design. The encoding lives in ProblemSerializer in core; this only delegates. Registering it is a convenience, not a correctness requirement: an application's pre-existing json() converter produces the same bytes, since Problem carries ProblemSerializer as its own serializer.

Parameters

json

governs formatting only (indentation and the like); the document's shape comes from the serializer attached to Problem.

Constructors

Link copied to clipboard
constructor(json: Json = Json)

Functions

Link copied to clipboard
open suspend override fun deserialize(charset: Charset, typeInfo: TypeInfo, content: ByteReadChannel): Any?

Reads a Problem from the request body, or returns null if the receiving type is anything else, leaving the body to the next converter.

Link copied to clipboard
open suspend override fun serialize(contentType: ContentType, charset: Charset, typeInfo: TypeInfo, value: Any?): OutgoingContent?

Writes value as application/problem+json, or null if it isn't a Problem. That is the interface's way of saying "not mine", so ContentNegotiation tries the next converter.