final case class JsonCodec[A](encoder: JsonEncoder[A], decoder: JsonDecoder[A]) extends Product with Serializable

A JsonCodec[A] instance has the ability to encode values of type A into JSON, together with the ability to decode such JSON into values of type A.

Instances of this trait should satisfy round-tripping laws: that is, for every value, instances must be able to successfully encode the value into JSON, and then successfully decode the same value from such JSON.

For more information, see JsonDecoder and JsonEncoder.

{{ val intCodec: JsonCodec[Int] = JsonCodec[Int]

intCodec.encodeJson(intCodec.encodeJson(42)) == Right(42) }}

Self Type
JsonCodec[A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonCodec
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new JsonCodec(encoder: JsonEncoder[A], decoder: JsonDecoder[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def *>[B](that: => JsonCodec[B])(implicit ev: <:<[Unit, A]): JsonCodec[B]
  4. final def <*(that: => JsonCodec[Unit]): JsonCodec[A]
  5. final def <*>[B](that: => JsonCodec[B]): JsonCodec[(A, B)]

    An alias for JsonCodec#zip.

  6. final def <+>[B](that: => JsonCodec[B]): JsonCodec[Either[A, B]]

    An alias for JsonCodec#orElseEither.

  7. final def <>(that: => JsonCodec[A]): JsonCodec[A]

    An alias for JsonCodec#orElse.

  8. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. final def decodeJson(str: CharSequence): Either[String, A]
  12. val decoder: JsonDecoder[A]
  13. final def encodeJson(a: A, indent: Option[Int]): CharSequence
  14. val encoder: JsonEncoder[A]
  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def orElse(that: => JsonCodec[A]): JsonCodec[A]
  23. final def orElseEither[B](that: => JsonCodec[B]): JsonCodec[Either[A, B]]
  24. def productElementNames: Iterator[String]
    Definition Classes
    Product
  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. final def transform[B](f: (A) => B, g: (B) => A): JsonCodec[B]
  27. final def transformOrFail[B](f: (A) => Either[String, B], g: (B) => A): JsonCodec[B]
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  31. final def zip[B](that: => JsonCodec[B]): JsonCodec[(A, B)]
  32. final def zipLeft(that: => JsonCodec[Unit]): JsonCodec[A]
  33. final def zipRight[B](that: => JsonCodec[B])(implicit ev: <:<[Unit, A]): JsonCodec[B]

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped