diff options
Diffstat (limited to 'README.markdown')
-rw-r--r-- | README.markdown | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/README.markdown b/README.markdown index 30ca8ed..6165839 100644 --- a/README.markdown +++ b/README.markdown @@ -171,7 +171,7 @@ Of course you can also supply (de)serialization logic for types that aren't case Here is one way to do it: ```scala -class Color(val name: String, val red: Int, val green: Int, val blue: Int) +case class Color(val name: String, val red: Int, val green: Int, val blue: Int) object MyJsonProtocol extends DefaultJsonProtocol { implicit object ColorJsonFormat extends RootJsonFormat[Color] { @@ -180,7 +180,7 @@ object MyJsonProtocol extends DefaultJsonProtocol { def read(value: JsValue) = value match { case JsArray(Vector(JsString(name), JsNumber(red), JsNumber(green), JsNumber(blue))) => - new Color(name, red.toInt, green.toInt, blue.toInt) + Color(name, red.toInt, green.toInt, blue.toInt) case _ => deserializationError("Color expected") } } |