Formats

@implicitNotFound("No org.json4s.Formats found. Try to bring an instance of org.json4s.Formats in scope or use the org.json4s.DefaultFormats.")
trait Formats extends Serializable

Formats to use when converting JSON. Formats are usually configured by using an implicit parameter:

implicit val formats: Formats = org.json4s.DefaultFormats
Companion:
object
Source:
Formats.scala
trait Serializable
class Object
trait Matchable
class Any

Value members

Abstract methods

Concrete methods

def +(extraHints: TypeHints): Formats

Adds the specified type hints to this formats.

Adds the specified type hints to this formats.

Source:
Formats.scala
def +(newSerializer: RichSerializer[_]): Formats

Adds the specified custom serializer to this formats.

Adds the specified custom serializer to this formats.

Source:
Formats.scala
def +(newSerializer: Serializer[_]): Formats

Adds the specified custom serializer to this formats.

Adds the specified custom serializer to this formats.

Source:
Formats.scala
def +(newSerializer: KeySerializer[_]): Formats

Adds the specified custom key serializer to this formats.

Adds the specified custom key serializer to this formats.

Source:
Formats.scala
def +[A](newSerializer: FieldSerializer[A]): Formats

Adds a field serializer for a given type to this formats.

Adds a field serializer for a given type to this formats.

Source:
Formats.scala
def ++(newSerializers: Iterable[Serializer[_]]): Formats

Adds the specified custom serializers to this formats.

Adds the specified custom serializers to this formats.

Source:
Formats.scala
def -(serializer: Serializer[_]): Formats

Removes the specified custom serializer from this formats.

Removes the specified custom serializer from this formats.

Source:
Formats.scala
def addKeySerializers(newKeySerializers: Iterable[KeySerializer[_]]): Formats

Adds the specified custom serializers to this formats.

Adds the specified custom serializers to this formats.

Source:
Formats.scala
def companions: List[(Class[_], AnyRef)]

Setting to false preserves library's behavior prior to 3.6, where companion object constructors were only considered when deserializing if there were no primary constructors. Setting to true preserves the backwards-incompatible change made in 3.6 to always consider companion object constructors when deserializing (https://github.com/json4s/json4s/pull/487).

Setting to false preserves library's behavior prior to 3.6, where companion object constructors were only considered when deserializing if there were no primary constructors. Setting to true preserves the backwards-incompatible change made in 3.6 to always consider companion object constructors when deserializing (https://github.com/json4s/json4s/pull/487).

Source:
Formats.scala
def emptyValueStrategy: EmptyValueStrategy
def fieldSerializers: List[(Class[_], FieldSerializer[_])]

Parameter name reading strategy. By default 'paranamer' is used.

Parameter name reading strategy. By default 'paranamer' is used.

Source:
Formats.scala
def primitives: Set[Type]
def wantsBigDecimal: Boolean
def wantsBigInt: Boolean
def withCompanions(comps: (Class[_], AnyRef)*): Formats
def withEmptyValueStrategy(strategy: EmptyValueStrategy): Formats

Prior to 3.6 companion object constructors were only considered when deserializing if there were no primary constructors. A backwards-incompatible change was made in 3.6 to always consider companion object constructors when deserializing (https://github.com/json4s/json4s/pull/487), and is the default setting (considerCompanionConstructors = true). This changes the setting to false to preserve pre-3.6 deserialization behavior.

Prior to 3.6 companion object constructors were only considered when deserializing if there were no primary constructors. A backwards-incompatible change was made in 3.6 to always consider companion object constructors when deserializing (https://github.com/json4s/json4s/pull/487), and is the default setting (considerCompanionConstructors = true). This changes the setting to false to preserve pre-3.6 deserialization behavior.

Source:
Formats.scala

Deprecated methods

@deprecated(message = "Use the internal methods in the companion object instead.", since = "3.6.4")
def customDeserializer(implicit format: Formats): PartialFunction[(TypeInfo, JValue), Any]
Deprecated
[Since version 3.6.4] Use the internal methods in the companion object instead.
Source:
Formats.scala
@deprecated(message = "Use the internal methods in the companion object instead.", since = "3.6.4")
def customKeyDeserializer(implicit format: Formats): PartialFunction[(TypeInfo, String), Any]
Deprecated
[Since version 3.6.4] Use the internal methods in the companion object instead.
Source:
Formats.scala
@deprecated(message = "Use the internal methods in the companion object instead.", since = "3.6.4")
def customKeySerializer(implicit format: Formats): PartialFunction[Any, String]
Deprecated
[Since version 3.6.4] Use the internal methods in the companion object instead.
Source:
Formats.scala
@deprecated(message = "Use the internal methods in the companion object instead.", since = "3.6.4")
def customSerializer(implicit format: Formats): PartialFunction[Any, JValue]
Deprecated
[Since version 3.6.4] Use the internal methods in the companion object instead.
Source:
Formats.scala
@deprecated(message = "Use withNullExtractionStrategy instead", since = "3.7.0")
Deprecated
[Since version 3.7.0] Use withNullExtractionStrategy instead
Source:
Formats.scala