Skip to content

Instantly share code, notes, and snippets.

@knutwalker
Created April 10, 2014 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knutwalker/10355424 to your computer and use it in GitHub Desktop.
Save knutwalker/10355424 to your computer and use it in GitHub Desktop.
so_22953741
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import spray.json._
import spray.json._
scala> import DefaultJsonProtocol._
import DefaultJsonProtocol._
scala> :paste
// Entering paste mode (ctrl-D to finish)
object Foo extends DefaultJsonProtocol {
implicit val fooFormat = jsonFormat1(Foo.apply)
}
case class Foo(bar: String)
// Exiting paste mode, now interpreting.
defined module Foo
defined class Foo
scala> Foo("baz").toJson
res0: spray.json.JsValue = {"bar":"baz"}
import spray.json._
import DefaultJsonProtocol._
object Foo extends DefaultJsonProtocol {
implicit val fooFormat = jsonFormat1(Foo.apply)
}
case class Foo(bar: String)
Foo("baz").toJson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment