ObjectTags

Specifies that an object of a class annotated using ObjectTags shall be tagged and serialized as CBOR major type 6: optional semantic tagging of other major types. Can be combined with CborArray and ValueTags. Note that ObjectTags will always be encoded directly before to the data of the tagged object, i.e. a value-tagged property of an object-tagged type will have the value tags preceding the object tags.

Example usage:

@ObjectTags(1337uL)
@Serializable
data class ClassAsTagged(
@SerialName("alg")
val alg: Int,
)

Encoding to CBOR results in the following byte string:

D9 0539         # tag(1337)
BF # map(*)
63 # text(3)
616C67 # "alg"
13 # unsigned(19)
FF # primitive(*)

See RFC 8949 3.4. Tagging of Items.

Properties

Link copied to clipboard