ProblemSerializer

The JSON codec for Problem, and Problem's own serializer.

Emits the canonical serialization of application/problem+json, with §3.2 extension members written as siblings of the §3.1 standard ones. Reading follows §3's tolerance rules.

Being the type's own serializer is a correctness requirement. An application that already registered a plain json() converter would otherwise win the match for application/json and silently emit {"extensions": {...}}, nested and invalid per the RFC. Attached to the type, that same path produces identical bytes to this one.

See also

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Describes the five standard members only. Extension members are runtime-determined and cannot appear in a static descriptor, which is why both directions go through kotlinx's JSON-specific encoder and decoder, not a format-agnostic one.

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): Problem

Reads a flat problem document: recognised members become properties, everything else becomes an extension member.

Link copied to clipboard
open override fun serialize(encoder: Encoder, value: Problem)

Writes the problem as a flat JSON object: the standard members that are set, then every extension member as a sibling.