Skip to content

Instantly share code, notes, and snippets.

@jkinkead
Created February 10, 2015 18:22
Show Gist options
  • Save jkinkead/938f87d1f58d182704ba to your computer and use it in GitHub Desktop.
Save jkinkead/938f87d1f58d182704ba to your computer and use it in GitHub Desktop.
implicit val intMapFormat = new JsonFormat[Map[Int, Int]] = {
override def write(map: Map[Int, Int]): JsValue = {
map.toSeq.toJson
}
override def read(json: JsValue): Map[Int, Int] = json match {
case value: JsArray => value.convertTo[Seq[(Int, Int)]].toMap
case _: => "Expected . . . "
}
}
val foo =...
implicit val myImplicitFoo = foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment