org.coursera.common.jsonformat

JsonFormats

Related Doc: package jsonformat

object JsonFormats

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JsonFormats
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait Extract[T] extends AnyRef

    Lets you pattern match JsValues to T.

    Lets you pattern match JsValues to T.

    For example,

    case class Foo(field: Int)
    
    object Foo {
      implicit val format: OFormat[Foo] = Json.format[Foo]
      object Extract extends JsonFormats.Extract[Foo]
    }
    
    val Foo.Extract(foo) = Json.parse("""{"field": 2}""")

Value Members

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

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

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

    Definition Classes
    AnyRef → Any
  4. object Implicits

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def caseClassFormat[T, S](apply: (S) ⇒ T, unapply: (T) ⇒ Option[S])(implicit serializedFormat: Format[S]): Format[T]

    Conveniently construct a format for a case class type.

    Conveniently construct a format for a case class type.

    For example:

    case class StorageValue(value: JsObject, version: String)
    
    object StorageValue {
      implicit val jsonFormat: Format[StorageValue] =
        JsonFormats.caseClassFormat((apply _).tupled, unapply)
    }
  7. def caseClassOFormat[T, S](apply: (S) ⇒ T, unapply: (T) ⇒ Option[S])(implicit serializedFormat: OFormat[S]): OFormat[T]

    Like caseClassFormat but for OFormat.

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def delegateFormat[T, S](fromDelegate: (S) ⇒ T, toDelegate: (T) ⇒ S)(implicit serializedFormat: Format[S]): Format[T]

  10. def delegateOFormat[T, S](fromDelegate: (S) ⇒ T, toDelegate: (T) ⇒ S)(implicit delegateFormat: OFormat[S]): OFormat[T]

  11. def delegateOWrites[T, S](toDelegate: (T) ⇒ S)(implicit delegateWrites: OWrites[S]): OWrites[T]

  12. def emptyFormat[T](t: ⇒ T): OFormat[T]

  13. def enumFormat[T <: EnumSymbol](enum: Enum[T]): Format[T]

  14. def enumerationFormat(enumeration: Enumeration): Format[Value] { def writes(value: enumeration.Value): play.api.libs.json.JsString }

  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def formatWithDefaults[T](delegate: OFormat[T], readsDefaults: JsObject): OFormat[T]

    Returns a new format that delegates to delegate for JSON parsing, but adds default values before calling reads.

    Returns a new format that delegates to delegate for JSON parsing, but adds default values before calling reads. Unfortunately delegate must be passed in and not constructed automatically due to Play JSON library macro limitations.

  19. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  21. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. def stringKeyFormat[T](implicit format: StringKeyFormat[T]): Format[T]

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped