serialize
Writes the problem as a flat JSON object: the standard members that are set, then every extension member as a sibling.
Throws
if encoder is not a JSON encoder. For application/problem+xml use ProblemXml from the problem-details-xml module.