Serializing
An object becomes JSON through its annotated properties. Empty values are left out, and every object says what it is.
Mutable classes with @JsonbProperty
Only properties annotated with @JsonbProperty take part. In Scala the annotation must reach the field, hence the @field meta-annotation. DTO marks a class as an object the mapper descends into.
serialize with a resolved type
The mapper works on a ResolvedClass from scala-universe, which carries the generic types of collections and maps. A JsonMapper holds what the application provides; to serialize plain DTOs it needs none of it.
What is written, and what is not
The output is compact and says as little as needed. Read these rules before you rely on a field being present.
A property of a concrete type is read as declared. A property of an abstract type, an interface or a type with @JsonbTypeInfo takes its subtype from @type, or from the key @JsonbTypeInfo names; only registered subtypes are accepted.