Created
January 2, 2013 23:51
-
-
Save seanparsons/4439489 to your computer and use it in GitHub Desktop.
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
val username: Option[String] = for { | |
parsed <- requestJson.parseOption // Parse the JSON. | |
jsonObject <- parsed.obj // Get the JSON as a JsonObject instance. | |
userIDJson <- jsonObject("userid") // Get the "userid" field from the JsonObject. | |
userID <- userIDJson.string // Get the value of the "userid" field. | |
user <- lookupUser(userID) // Get an instance of User for the user ID. | |
} yield user.username |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment