trait JsonDecoder[A] extends JsonDecoderPlatformSpecific[A]

A JsonDecoder[A] instance has the ability to decode JSON to values of type A, potentially failing with an error if the JSON content does not encode a value of the given type.

Self Type
JsonDecoder[A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonDecoder
  2. JsonDecoderPlatformSpecific
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def unsafeDecode(trace: List[JsonError], in: RetractReader): A

    Low-level, unsafe method to decode a value or throw an exception.

    Low-level, unsafe method to decode a value or throw an exception. This method should not be called in application code, although it can be implemented for user-defined data structures.

Concrete 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: => JsonDecoder[B]): JsonDecoder[B]

    An alias for JsonDecoder#zipRight.

  4. final def <*[B](that: => JsonDecoder[B]): JsonDecoder[A]

    An alias for JsonDecoder#zipLeft.

  5. final def <*>[B](that: => JsonDecoder[B]): JsonDecoder[(A, B)]

    An alias for JsonDecoder#zip.

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

    An alias for JsonDecoder#orElseEither.

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

    An alias for JsonDecoder#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]

    Attempts to decode a value of type A from the specified CharSequence, but may fail with a human-readable error message if the provided text does not encode a value of this type.

    Attempts to decode a value of type A from the specified CharSequence, but may fail with a human-readable error message if the provided text does not encode a value of this type.

    Note: This method may not entirely consume the specified character sequence.

  12. final def decodeJsonPipeline(delimiter: JsonStreamDelimiter = JsonStreamDelimiter.Array): ZPipeline[Any, Throwable, Char, A]
    Definition Classes
    JsonDecoderPlatformSpecific
  13. final def decodeJsonStream[R](stream: ZStream[R, Throwable, Char]): ZIO[R, Throwable, A]

    Attempts to decode a stream of characters into a single value of type A, but may fail with a human-readable exception if the stream does not encode a value of this type.

    Attempts to decode a stream of characters into a single value of type A, but may fail with a human-readable exception if the stream does not encode a value of this type.

    Note: This method may not consume the full string.

    Definition Classes
    JsonDecoderPlatformSpecific
    See also

    also decodeJsonStreamInput

  14. final def decodeJsonStreamInput[R](stream: ZStream[R, Throwable, Byte], charset: Charset = StandardCharsets.UTF_8): ZIO[R, Throwable, A]

    Attempts to decode a stream of bytes using the user supplied Charset into a single value of type A, but may fail with a human-readable exception if the stream does not encode a value of this type.

    Attempts to decode a stream of bytes using the user supplied Charset into a single value of type A, but may fail with a human-readable exception if the stream does not encode a value of this type.

    Note: This method may not consume the full string.

    Definition Classes
    JsonDecoderPlatformSpecific
    See also

    decodeJsonStream For a Char stream variant

  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  18. def fromJsonAST(json: Json): Either[String, A]

    Decode a value from an already parsed Json AST.

    Decode a value from an already parsed Json AST.

    The default implementation encodes the Json to a byte stream and uses decode to parse that. Override to provide a more performant implementation.

  19. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. final def map[B](f: (A) => B): JsonDecoder[B]

    Returns a new codec whose decoded values will be mapped by the specified function.

  23. final def mapOrFail[B](f: (A) => Either[String, B]): JsonDecoder[B]

    Returns a new codec whose decoded values will be mapped by the specified function, which may itself decide to fail with some type of error.

  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def orElse[A1 >: A](that: => JsonDecoder[A1]): JsonDecoder[A1]

    Returns a new codec that combines this codec and the specified codec using fallback semantics: such that if this codec fails, the specified codec will be tried instead.

    Returns a new codec that combines this codec and the specified codec using fallback semantics: such that if this codec fails, the specified codec will be tried instead. This method may be unsafe from a security perspective: it can use more memory than hand coded alternative and so lead to DOS.

    For example, in the case of an alternative between Int and Boolean, a hand coded alternative would look like:

    val decoder: JsonDecoder[AnyVal] = JsonDecoder.peekChar[AnyVal] { case 't' | 'f' => JsonDecoder[Boolean].widen case c => JsonDecoder[Int].widen }

  28. final def orElseEither[B](that: => JsonDecoder[B]): JsonDecoder[Either[A, B]]

    Returns a new codec that combines this codec and the specified codec using fallback semantics: such that if this codec fails, the specified codec will be tried instead.

  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. def unsafeDecodeMissing(trace: List[JsonError]): A
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  35. final def widen[B >: A]: JsonDecoder[B]

    Returns this decoder but widened to the its given super-type

  36. final def zip[B](that: => JsonDecoder[B]): JsonDecoder[(A, B)]

    Returns a new codec that combines this codec and the specified codec into a single codec that decodes a tuple of the values decoded by the respective codecs.

  37. final def zipLeft[B](that: => JsonDecoder[B]): JsonDecoder[A]

    Zips two codecs, but discards the output on the right hand side.

  38. final def zipRight[B](that: => JsonDecoder[B]): JsonDecoder[B]

    Zips two codecs, but discards the output on the left hand side.

  39. final def zipWith[B, C](that: => JsonDecoder[B])(f: (A, B) => C): JsonDecoder[C]

    Zips two codecs into one, transforming the outputs of zip codecs by the specified function.

Inherited from JsonDecoderPlatformSpecific[A]

Inherited from AnyRef

Inherited from Any

Ungrouped