Class

org.json4s

ReaderSyntax

Related Doc: package json4s

Permalink

final class ReaderSyntax extends AnyVal

Source
ReaderSyntax.scala
Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ReaderSyntax
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ReaderSyntax(jv: JValue)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. def as[A](implicit reader: Reader[A]): A

    Permalink

    Given that an implicit reader of type A is in scope It will deserialize the org.json4s.JValue to an object of type A

    Given that an implicit reader of type A is in scope It will deserialize the org.json4s.JValue to an object of type A

    Example:

    case class Person(name: String)
    implicit object PersonReader extends Reader[Person] {
      def read(json: JValue): Person = Person((json \ "name").extract[String])
    }
    JObject(JField("name", JString("Joe")) :: Nil).as[Person]
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def getAs[A](implicit reader: Reader[A]): Option[A]

    Permalink

    Given that an implicit reader of type A is in scope It will deserialize the org.json4s.JValue to an object of type Option[A]

    Given that an implicit reader of type A is in scope It will deserialize the org.json4s.JValue to an object of type Option[A]

    Example:

    case class Person(name: String)
    implicit object PersonReader extends Reader[Person] {
      def read(json: JValue): Person = Person((json \ "name").extract[String])
    }
    JObject(JField("name", JString("Joe")) :: Nil).getAs[Person]
  7. def getAsOrElse[A](default: ⇒ A)(implicit reader: Reader[A]): A

    Permalink

    Given that an implicit reader of type A is in scope It will deserialize the org.json4s.JValue to an object of type A if an error occurs it will return the default value.

    Given that an implicit reader of type A is in scope It will deserialize the org.json4s.JValue to an object of type A if an error occurs it will return the default value.

    Example:

    case class Person(name: String)
    implicit object PersonReader extends Reader[Person] {
      def read(json: JValue): Person = Person((json \ "name").extract[String])
    }
    JObject(JField("name", JString("Joe")) :: Nil).getAsOrElse(Person("Tom"))
  8. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  9. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  10. def toString(): String

    Permalink
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped