Last active
December 31, 2016 06:13
-
-
Save josep2/86e4e400c6ca16c98e51038c43421b28 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
import spray.json._ | |
val myJson: String = "{ | |
color: "red", | |
value: "#f00" | |
}" // JSON defined above | |
case class Settings(color: String, value: String) // Case class for the JSON | |
object SettingsProtocol extends DefaultJsonProtocol { | |
implicit val settingsFormat = jsonFormat2(Settings) | |
} | |
import SettingsProtocol._ | |
Json.parse(myJson).convertTo[Settings] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment