When i post from angularjs
{name:"John", age: 26}
i get BadRequest, however if is manually post
{"name":"John", "age": 26}
it works
in the Scala/Play side its the simple case class with Json formatting
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class Customer(name: String, age: Int)
implicit val customerFormat = Json.format[Customer]
the Action is a simple one
def save = Action(parse.json) { request =>
request.body.validate[Customer].map { customer =>
myDAO.saveCustomer(customer)
Ok(toJson(customer))
}.getOrElse(BadRequest("invalid json"))
})
}
i guess the answer is either make angularjs quote the keys, or make play to ignore the the lack of keys, i'll need help on how do i do either of it, or am i missing something