Json
Creates a JsonCodec for the annotated class.
Note that there are several limitations which classes can be annotated:
it and all enclosing classes must have
internalorpublicvisibilityit must not be
abstract,sealedorinnerit must not be generic
Types
Creates an object implementing the annotated interface which in turn extends JsonCodecProvider and no other interfaces. That object can be accessed using JsonCodecProvider.Companion.generated. It provides all codecs which have been generated using @Json annotations. The annotated interface also specifies the JsonCodingContext type being used by all generated codecs.
Visibility of a created codec
The annotated constructor of a class annotated with @Json will be used for decoding instances of the class as JSON even if @Json.decoding would exclude them by default or if there would be multiple constructors and a decision needs to be made. This does not apply if @Json.decoding is set to none in which case an error will be raised.
By annotating an extension function with this annotation additional code can be executed as part of the encoding of a @Json-annotated class.
The way in which the annotation processor can decode and instantiate a @Json-annotated class.
The way in which the annotation processor can encode a @Json-annotated class.
Annotated properties of a class annotated with @Json will be used for encoding instances of the class as JSON even if @Json.encoding would exclude them by default. This does not apply if @Json.encoding is set to none in which case an error will be raised.
The way in which the annotation processor will represent a @Json-annotated class in JSON.
Properties
Package name of the generated codec class.
Visibility of the generated codec class.
Defines how to create an instance of the annotated class when decoding it from JSON.
Defines how an instance of the annotated class will be encoded to JSON.
Defines how the annotated class is represented in JSON.