Created
April 10, 2014 08:18
-
-
Save knutwalker/10355424 to your computer and use it in GitHub Desktop.
so_22953741
This file contains 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
[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"} |
This file contains 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
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