SnapshotConfig

data class SnapshotConfig(val namingStrategy: String = "none", val classDiscriminator: String = "type", val classDiscriminatorMode: String = "POLYMORPHIC", val ignoreUnknownKeys: Boolean = false, val encodeDefaults: Boolean = false, val explicitNulls: Boolean = true, val coerceInputValues: Boolean = false, val useAlternativeNames: Boolean = true, val useArrayPolymorphism: Boolean = false, val allowStructuredMapKeys: Boolean = false, val allowSpecialFloatingPointValues: Boolean = false, val isLenient: Boolean = false, val decodeEnumsCaseInsensitive: Boolean = false, val allowTrailingComma: Boolean = false, val allowComments: Boolean = false)

The subset of a kotlinx.serialization.json.Json configuration that affects the wire shape or decode behavior, captured as part of a Snapshot so that config changes are diffed and classified like any other change (design §6).

Defaults mirror kotlinx-serialization's own Json defaults, so a snapshot built without an explicit config describes a stock Json {} instance.

Constructors

Link copied to clipboard
constructor(namingStrategy: String = "none", classDiscriminator: String = "type", classDiscriminatorMode: String = "POLYMORPHIC", ignoreUnknownKeys: Boolean = false, encodeDefaults: Boolean = false, explicitNulls: Boolean = true, coerceInputValues: Boolean = false, useAlternativeNames: Boolean = true, useArrayPolymorphism: Boolean = false, allowStructuredMapKeys: Boolean = false, allowSpecialFloatingPointValues: Boolean = false, isLenient: Boolean = false, decodeEnumsCaseInsensitive: Boolean = false, allowTrailingComma: Boolean = false, allowComments: Boolean = false)

Properties

Link copied to clipboard

Whether the reader accepts C/Java-style comments.

Link copied to clipboard

Whether NaN/Infinity are written and accepted (otherwise encode and decode both throw).

Link copied to clipboard

Whether maps with non-primitive (structured) keys are allowed, written as a flat [k1,v1,k2,v2] array. Without it such maps can be neither encoded nor decoded.

Link copied to clipboard

Whether the reader accepts a trailing comma in objects and arrays.

Link copied to clipboard

Discriminator key for polymorphic types.

Link copied to clipboard

Whether/where the class discriminator is emitted (POLYMORPHIC, NONE, ALL_JSON_OBJECTS). Setting it to NONE drops the discriminator entirely, which is a breaking change for polymorphic decoding.

Link copied to clipboard

Whether invalid/absent values are coerced to defaults on read.

Link copied to clipboard

Whether the reader matches enum constants case-insensitively.

Link copied to clipboard

Whether default values are written to the wire.

Link copied to clipboard

Whether nulls are written for nullable properties.

Link copied to clipboard

Whether the reader silently drops unknown keys.

Link copied to clipboard

Whether the reader accepts malformed-but-common JSON (unquoted strings, quoted literals).

Link copied to clipboard

Naming strategy applied to every key, or "none".

Link copied to clipboard

Whether @JsonNames alternative keys are honored on decode.

Link copied to clipboard

Whether polymorphic values are written/read as ["type",{...}] arrays instead of {"type":"type",...} objects. Each shape is rejected by a reader expecting the other.