package playUtils
- Source
- package.scala
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- playUtils
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Type Members
- trait JsonFormats extends AnyRef
Value Members
-
def
javaEnumFormat[E <: Enum[E]](implicit arg0: ClassTag[E]): Format[E]
Create Play JSON Reads/Writes (Formatter) for any Java Enum.
Create Play JSON Reads/Writes (Formatter) for any Java Enum. Use like this (the unit tests contain similar code):
implicit val myEnumFormat = javaEnumFormat[MyEnum] Json.toJson(DiscountEnum.FullPrice) == "FullPrice" Json.fromJson[DiscountEnum](JsString("FullPrice")) == DiscountEnum.FullPrice
- See also
[http://stackoverflow.com/a/34045056/553865]
- implicit object JsonFormatImplicits extends JsonFormats