Created
April 4, 2015 13:25
-
-
Save debasishg/b2bb9e12f9de6f601d86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Writes[T] { | |
def writes(o: T): JsValue | |
} | |
trait Reads[T] { | |
def reads(json: JsValue): T | |
} | |
trait Format[T] extends Writes[T] with Reads[T] | |
object JsonSerialization { | |
def tojson[T](o: T)(implicit tjs: Writes[T]): JsValue = tjs.writes(o) | |
def fromjson[T](json: JsValue)(implicit fjs: Reads[T]): T = fjs.reads(json) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment