Skip to content

Instantly share code, notes, and snippets.

View leewin12's full-sized avatar

greg.lee leewin12

View GitHub Profile
@leewin12
leewin12 / gist:5956083
Last active December 19, 2015 12:39
Play2 post json string and return its value
case class TestObj(name: String, msg: String)
def insertMulti() = Action {
implicit req =>
// parse posted json objs
val json = req.body.asJson.getOrElse(JsNull)
val objs = json.as[List[JsValue]].map {
json => Json.reads[TestObj].reads(json).get
}
// return what we got as json string