java.lang.Object
io.quarkus.resteasy.reactive.kotlin.serialization.common.runtime.JsonConfig

public class JsonConfig extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Removes JSON specification restriction on special floating-point values such as `NaN` and `Infinity` and enables their serialization and deserialization.
    boolean
    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]`.
    boolean
    Specifies if trailing comma is allowed.
    Name of the class descriptor property for polymorphic serialization.
    boolean
    Enables coercing incorrect JSON values to the default property value in the following cases: 1.
    boolean
    Specifies if the enum values should be decoded case insensitively.
    boolean
    Specifies whether default values of Kotlin properties should be encoded.
    boolean
    Specifies whether `null` values should be encoded for nullable properties and must be present in JSON object during decoding.
    boolean
    Specifies whether encounters of unknown properties in the input JSON should be ignored instead of throwing [SerializationException].
    boolean
    Removes JSON specification restriction (RFC-4627) and makes parser more liberal to the malformed input.
    Specifies the JsonNamingStrategy that should be used for all properties in classes for serialization and deserialization.
    boolean
    Specifies whether resulting JSON should be pretty-printed.
    Specifies indent string to use with [prettyPrint] mode
    boolean
    Specifies whether Json instance makes use of [JsonNames] annotation.
    boolean
    Switches polymorphic serialization to the default array format.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • allowSpecialFloatingPointValues

      @ConfigItem(defaultValue="false") public boolean allowSpecialFloatingPointValues
      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.
    • allowStructuredMapKeys

      @ConfigItem(defaultValue="false") public boolean allowStructuredMapKeys
      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]`.
    • classDiscriminator

      @ConfigItem(defaultValue="type") public String classDiscriminator
      Name of the class descriptor property for polymorphic serialization.
    • coerceInputValues

      @ConfigItem(defaultValue="false") public boolean coerceInputValues
      Enables coercing incorrect JSON values to the default property value in the following cases: 1. JSON value is `null` but property type is non-nullable. 2. Property type is an enum type, but JSON value contains unknown enum member.
    • encodeDefaults

      @ConfigItem(defaultValue="true") public boolean encodeDefaults
      Specifies whether default values of Kotlin properties should be encoded.
    • explicitNulls

      @ConfigItem(defaultValue="true") public boolean explicitNulls
      Specifies whether `null` values should be encoded for nullable properties and must be present in JSON object during decoding.

      When this flag is disabled properties with `null` values without default are not encoded; during decoding, the absence of a field value is treated as `null` for nullable properties without a default value.

      true by default.

    • ignoreUnknownKeys

      @ConfigItem(defaultValue="false") public boolean ignoreUnknownKeys
      Specifies whether encounters of unknown properties in the input JSON should be ignored instead of throwing [SerializationException].
    • isLenient

      @ConfigItem(defaultValue="false") public boolean isLenient
      Removes JSON specification restriction (RFC-4627) and makes parser more liberal to the malformed input. In lenient mode quoted boolean literals, and unquoted string literals are allowed.

      Its relaxations can be expanded in the future, so that lenient parser becomes even more permissive to invalid value in the input, replacing them with defaults.

    • prettyPrint

      @ConfigItem(defaultValue="false") public boolean prettyPrint
      Specifies whether resulting JSON should be pretty-printed.
    • prettyPrintIndent

      @ConfigItem(defaultValue=" ") public String prettyPrintIndent
      Specifies indent string to use with [prettyPrint] mode
    • useAlternativeNames

      @ConfigItem(defaultValue="true") public boolean useAlternativeNames
      Specifies whether Json instance makes use of [JsonNames] annotation.

      Disabling this flag when one does not use [JsonNames] at all may sometimes result in better performance, particularly when a large count of fields is skipped with [ignoreUnknownKeys].

    • useArrayPolymorphism

      @ConfigItem(defaultValue="false") public boolean useArrayPolymorphism
      Switches polymorphic serialization to the default array format. This is an option for legacy JSON format and should not be generally used.
    • namingStrategy

      @ConfigItem(name="naming-strategy") public Optional<String> namingStrategy
      Specifies the JsonNamingStrategy that should be used for all properties in classes for serialization and deserialization. This strategy is applied for all entities that have StructureKind.CLASS.

      null by default.

      This element can be one of two things:

      1. the fully qualified class name of a type implements the NamingStrategy interface and has a no-arg constructor
      2. a value in the form NamingStrategy.SnakeCase which refers to built-in values provided by the kotlin serialization library itself.
    • decodeEnumsCaseInsensitive

      @ConfigItem(defaultValue="false") public boolean decodeEnumsCaseInsensitive
      Specifies if the enum values should be decoded case insensitively.
    • allowTrailingComma

      @ConfigItem(defaultValue="false") public boolean allowTrailingComma
      Specifies if trailing comma is allowed.
  • Constructor Details

    • JsonConfig

      public JsonConfig()
  • Method Details