Skip to content

Instantly share code, notes, and snippets.

@d6y
Created October 6, 2012 12:10
Show Gist options
  • Select an option

  • Save d6y/3844759 to your computer and use it in GitHub Desktop.

Select an option

Save d6y/3844759 to your computer and use it in GitHub Desktop.
trait SNSSerializer[T] {
implicit val formats = DefaultFormats
def json(t: T): JObject
def write(t: T): String = Serialization.write(json(t))
}
implicit object ChatFormat extends SNSSerializer[Chat] {
def json(c: Chat) : JObject = ("msg" -> c.text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment