JsonBuilder

Builder of the Json instance provided by Json { ... } factory function.

Properties

Link copied to clipboard

Removes JSON specification restriction on special floating-point values such as NaN and Infinity and enables their serialization and deserialization. When enabling it, please ensure that the receiving party will be able to encode and decode these special values. false by default.

Link copied to clipboard

Enables structured objects to be serialized as map keys by changing serialized form of the map from JSON object (key-value pairs) to flat array like [k1, v1, k2, v2]. false by default.

Link copied to clipboard

Allows parser to accept trailing (ending) commas in JSON objects and arrays, making inputs like [1, 2, 3,] valid.

Link copied to clipboard

Name of the class descriptor property for polymorphic serialization. "type" by default.

Link copied to clipboard

Defines which classes and objects should have class discriminator added to the output. ClassDiscriminatorMode.POLYMORPHIC by default.

Link copied to clipboard

Enables coercing incorrect JSON values to the default property value (if exists) in the following cases:

Link copied to clipboard

Enables decoding enum values in a case-insensitive manner. Encoding is not affected.

Link copied to clipboard

Specifies whether default values of Kotlin properties should be encoded. false by default.

Link copied to clipboard

Specifies whether null values should be encoded for nullable properties and must be present in JSON object during decoding.

Link copied to clipboard

Specifies whether encounters of unknown properties in the input JSON should be ignored instead of throwing SerializationException. false by default.

Link copied to clipboard

Removes JSON specification restriction (RFC-4627) and makes parser more liberal to the malformed input. In lenient mode, unquoted JSON keys and string values are allowed.

Link copied to clipboard

Specifies JsonNamingStrategy that should be used for all properties in classes for serialization and deserialization.

Link copied to clipboard

Specifies whether resulting JSON should be pretty-printed. false by default.

Link copied to clipboard

Specifies indent string to use with prettyPrint mode 4 spaces by default. Experimentality note: this API is experimental because it is not clear whether this option has compelling use-cases.

Link copied to clipboard

Module with contextual and polymorphic serializers to be used in the resulting Json instance.

Link copied to clipboard

Specifies whether Json instance makes use of JsonNames annotation.

Link copied to clipboard

Switches polymorphic serialization to the default array format. This is an option for legacy JSON format and should not be generally used. false by default.