(common, js, jvm, native)
A skeleton implementation of both Decoder and CompositeDecoder that can be used
for simple formats and for testability purpose.
Most of the decode*
methods have default implementation that delegates decodeValue(value: Any) as TargetType
.
See Decoder documentation for information about each particular decode*
method.
(common, js, jvm, native)
A skeleton implementation of both Encoder and CompositeEncoder that can be used
for simple formats and for testability purpose.
Most of the encode*
methods have default implementation that delegates encodeValue(value: Any)
.
See Encoder documentation for information about each particular encode*
method.
(common, js, jvm, native)
SerialFormat that allows conversion to and from ByteArray
via dump and load methods
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native)
Implements encoding and decoding classes to/from bytes
using CBOR specification.
It is typically used by constructing an application-specific instance, with configured behaviour, and,
if necessary, registered custom serializers (in SerialModule provided by context constructor parameter).
(common, js, jvm, native)
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native)
CompositeDecoder is a part of decoding process that is bound to a particular structured part of
the serialized form, described by the serial descriptor passed to Decoder.beginStructure.
(common, js, jvm, native)
CompositeEncoder is a part of encoding process that is bound to a particular structured part of
the serialized form, described by the serial descriptor passed to Encoder.beginStructure.
(common, js, jvm, native)
This class provides support for retrieving a serializer in runtime, instead of using the one precompiled by the serialization plugin.
This serializer is enabled by ContextualSerialization.
(common, js, jvm, native)
Instructs to use ContextSerializer on an annotated property or type usage.
If used on a file, instructs to use ContextSerializer for all listed KClasses.
(common, js, jvm, native)
Decoder is a core deserialization primitive that encapsulates the knowledge of the underlying
format and an underlying storage, exposing only structural methods to the deserializer, making it completely
format-agnostic. Deserialization process takes a decoder and asks him for a sequence of primitive elements,
defined by a deserializer serial form, while decoder knows how to retrieve these primitive elements from an actual format
representations.
(common, js, jvm, native)
Deserialization strategy defines the serial form of a type T, including its structural description,
declared by the descriptor and the actual deserialization process, defined by the implementation
of the deserialize method.
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(js)
Converts native JavaScript objects into Kotlin ones, verifying their types.
(common, js, jvm, native)
A SerialModule which is empty and always returns null
.
(common, js, jvm, native)
Encoder is a core serialization primitive that encapsulates the knowledge of the underlying
format and its storage, exposing only structural methods to the serializer, making it completely
format-agnostic. Serialization process transforms a single value into the sequence of its
primitive elements, also called its serial form, while encoding transforms these primitive elements into an actual
format representation: JSON string, ProtoBuf ByteArray, in-memory map representation etc.
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native)
This annotation marks declaration which try to obtain serializer implicitly
using reflection, e.g. from KClass or instance itself.
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native)
Public API marked with this annotation is effectively internal, which means
it should not be used outside of kotlinx.serialization
.
Signature, semantics, source and binary compatibilities are not guaranteed for this API
and will be changed without any warnings or migration aids.
If you cannot avoid using internal API to solve your problem, please report your use-case to serialization's issue tracker.
(common, js, jvm, native)
The main entry point to work with JSON serialization.
It is typically used by constructing an application-specific instance, with configured json-specific behaviour
(configuration constructor parameter) and, if necessary, registered
custom serializers (in SerialModule provided by context constructor parameter).
Then constructed instance can be used either as regular SerialFormat or StringFormat
or for converting objects to JsonElement back and forth.
(common, js, jvm, native)
Class representing JSON array, consisting of indexed values, where value is arbitrary JsonElement
(common, js, jvm, native)
DSL builder for a JsonArray. To create an instance of builder, use jsonArray.
(common, js, jvm, native)
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonArray.
It can only be used by with Json format an its input (JsonInput and JsonOutput).
(common, js, jvm, native)
Builder to conveniently build Json instances.
Properties of this builder are directly matched with properties of JsonConfiguration.
(common, js, jvm, native)
The class responsible for JSON-specific customizable behaviour in Json format.
(common, js, jvm, native)
Thrown when Json has failed to parse the given JSON string or deserialize it to a target class.
(common, js, jvm, native)
Class representing single JSON element.
Can be JsonPrimitive, JsonArray or JsonObject.
(common, js, jvm, native)
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonElement.
It can only be used by with Json format an its input (JsonInput and JsonOutput).
Currently, this hierarchy has no guarantees on descriptor content.
(common, js, jvm, native)
Thrown when Json has failed to create a JSON string from the given value.
(common, js, jvm, native)
Generic exception indicating a problem with JSON serialization and deserialization.
(common, js, jvm, native)
Decoder used by Json during deserialization.
This interface can be used to inject desired behaviour into a serialization process of Json.
(common, js, jvm, native)
Class representing JSON literals: numbers, booleans and string.
Strings are always quoted.
(common, js, jvm, native)
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonLiteral.
It can only be used by with Json format an its input (JsonInput and JsonOutput).
(common, js, jvm, native)
Class representing JSON null
value
(common, js, jvm, native)
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonNull.
It can only be used by with Json format an its input (JsonInput and JsonOutput).
(common, js, jvm, native)
Class representing JSON object, consisting of name-value pairs, where value is arbitrary JsonElement
(common, js, jvm, native)
DSL builder for a JsonObject. To create an instance of builder, use json.
(common, js, jvm, native)
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonObject.
It can only be used by with Json format an its input (JsonInput and JsonOutput).
(common, js, jvm, native)
Encoder used by Json during serialization.
This interface can be used to inject desired behaviour into a serialization process of Json.
(common, js, jvm, native)
Base class for custom serializers that allows selecting polymorphic serializer
without a dedicated class discriminator, on a content basis.
(common, js, jvm, native)
Class representing JSON primitive value. Can be either JsonLiteral or JsonNull.
(common, js, jvm, native)
External Serializer object providing SerializationStrategy and DeserializationStrategy for JsonPrimitive.
It can only be used by with Json format an its input (JsonInput and JsonOutput).
(common, js, jvm, native)
Base class for custom serializers that allows manipulating an abstract JSON
representation of the class before serialization or deserialization.
(common, js, jvm, native) (extensions in package kotlinx.serialization)
(common, js, jvm, native)
KSerializer is responsible for the representation of a serial form of a type T
in terms of encoders and decoders and for constructing and deconstructing T
from/to a sequence of encoding primitives. For classes marked with @Serializable, can be
obtained from generated companion extension .serializer()
or from serializer() function.
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native)
Serializer that encodes and decodes Long as its string representation.
(common, js, jvm, native)
Thrown when KSerializer hasn't received property from Decoder, and this property was not optional.
(common, js, jvm, native)
Instructs to use PolymorphicSerializer on an annotated property or type usage.
When used on class, replaces its serializer with PolymorphicSerializer everywhere.
(common, js, jvm, native)
Polymorphic kind represents a (bounded) polymorphic value, that is referred
by some base class or interface, but its structure is defined by one of the possible implementations.
Polymorphic kind is, by its definition, a union kind and is extracted to its own subtype to emphasize
bounded and sealed polymorphism common property: not knowing the actual type statically and requiring
formats to additionally encode it.
(common, js, jvm, native)
A builder which registers all its content for polymorphic serialization in the scope of baseClass.
If baseSerializer is present, registers it as a serializer for baseClass (which will be used if base class is serializable).
Subclasses with its serializers can be added via subclass or with.
(common, js, jvm, native)
This class provides support for multiplatform polymorphic serialization for interfaces and abstract classes.
(common, js, jvm, native)
Values of primitive kinds usually are represented as a single value.
All default serializers for Kotlin primitives types
and String have primitive kind.
(common, js, jvm, native)
Transforms a Serializable class' properties into a single flat Map which consists of
string keys and primitive type values, and vice versa. Located in separated kotlinx-serialization-properties
artifact.
(common, js, jvm, native)
Implements encoding and decoding classes to/from bytes
using Proto2 specification.
It is typically used by constructing an application-specific instance, with configured specific behaviour
and, if necessary, registered custom serializers (in SerialModule provided by context constructor parameter).
(common, js, jvm, native)
(common, js, jvm, native)
Specifies protobuf id (a unique number for a field in the protobuf message)
assigned to a Kotlin property.
(common, js, jvm, native)
Represents a number format in protobuf encoding.
(common, js, jvm, native)
Instructs to use a particular ProtoNumberType for a property of integer number type.
Affect Byte, Short, Int, Long and Char properties and does not affect others.
(common, js, jvm, native)
Indicates that property must be present during deserialization process,
even if it has default value.
(common, js, jvm, native)
This class provides support for multiplatform polymorphic serialization of sealed classes.
(common, js, jvm, native)
Serial descriptor is an inherent property of KSerializer that describes the structure of the serializable type.
The structure of the serializable type is not only the property of the type, but also of the serializer as well,
meaning that one type can have multiple descriptors that have completely different structure.
(common, js, jvm, native)
Builder for SerialDescriptor to be used in custom serializers.
(common, js, jvm, native)
Represents an instance of a serialization format
that can interact with KSerializer and is a supertype of all entry points for a serialization.
It does not impose any restrictions on a serialized form or underlying storage, neither it exposes them.
Concrete data types and API for user-interaction are responsibility of a concrete subclass or subinterface,
e.g. StringFormat, BinaryFormat or Json.
(common, js, jvm, native)
When annotation class is marked with @SerialInfo
, compiler plugin can instantiate it
and put into SerialDescriptor, to be retrieved later during serialization process.
(common, js, jvm, native)
Sets specific serializer for class, property or type argument.
When argument is omitted, plugin will generate default implementation inside the class.
(common, js, jvm, native)
A generic exception indicating the problem during serialization or deserialization process
(common, js, jvm, native)
Serialization strategy defines the serial form of a type T, including its structural description,
declared by the descriptor and the actual serialization process, defined by the implementation
of the serialize method.
(common, js, jvm, native)
Instructs plugin to turn this class into serializer for specified class forClass.
However, it would not be used automatically. To apply it on particular class or property,
use Serializable or UseSerializers, or ContextualSerialization with runtime registration.
(common, js, jvm, native)
Thrown on an attempt to register serializer (for contextual or polymorphic serialization)
for some class twice.
(common, js, jvm, native)
A builder class for SerializersModule DSL. To create an instance of builder, use SerializersModule factory function.
(common, js, jvm, native)
Serial kind is an intrinsic property of SerialDescriptor that indicates how
the corresponding type is structurally represented by its serializer.
(common, js, jvm, native)
SerialModule is a collection of serializers used by ContextSerializer and PolymorphicSerializer
to override or provide serializers at the runtime, whereas at the compile-time they provided by the serialization plugin.
It can be considered as a map where serializers can be found using their statically known KClasses.
(common, js, jvm, native)
SerialModuleCollector can introspect and accumulate content of any SerialModule via SerialModule.dumpTo,
using a visitor-like pattern: contextual and polymorphic functions are invoked for each registered serializer.
(common, js, jvm, native)
Overrides name visible to the runtime part of serialization framework
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native) (extensions in package kotlinx.serialization.builtins)
(common, js, jvm, native)
SerialFormat that allows conversion to and from String
via stringify and parse methods
(common, js, jvm, native)
Structure kind represents values with composite structure of nested elements of depth and arbitrary number.
We acknowledge following structured kinds:
(common, js, jvm, native)
Marks this property invisible for whole serialization framework.
Transient properties must have default values.
(common, js, jvm, native)
Union structure kind represents a tagged union structure,
meaning that the type is represent by one of a multiple possible values (potentially unknown).
An example of such union kind can be enum or its derivatives, such as "one of known strings".
(common, js, jvm, native)
Thrown when KSerializer received unknown property index from CompositeDecoder.decodeElementIndex.
(common, js, jvm, native)
This annotation marks declarations with default parameters that are subject to semantic change without a migration path.
(common, js, jvm, native)
(common, js, jvm, native)
(common, js, jvm, native)
Adds serializerClasses to serializers resolving process inside the plugin.
Each of serializerClasses must implement KSerializer.