I have a problem with the 2.1.1 playback platform (Java) telling me that I am sending Invalid JSON. A similar problem and possibly the same problem for the 2.x and 2.1.0 platforms, but it should have been resolved in the game infrastructure 2.1.1 afaik: see Invalid JSON in the Play Framework 2.1
This is what I do in the code, I tried to make it a little shorter:
import org.codehaus.jackson.JsonFactory; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonParser; import play.libs.Json; import play.mvc.BodyParser; @BodyParser.Of(BodyParser.Json.class) public static Result login() { JsonNode json = request().body().asJson(); }
When I run:
curl -v -H "Content-Type: application/json" -X POST -d '{"email":" test@test.de ","password":"test"}' http://localhost:9000/mobile/login
I get the following answer:
< HTTP/1.1 400 Bad Request < Content-Type: text/html; charset=utf-8 < Content-Length: 1917 ... <p id="detail"> For request 'POST /mobile/login' [Invalid Json] </p> ...
I cleaned my project and repeated it several times. When I start playback, I get the following output:
[info] Loading project definition from /path/to/project [info] Set current project to FFPushAlarmPlay (in build file:/path/to) [info] This is sbt 0.12.2 [info] The current project is {file:/path/to}... [info] The current project is built against Scala 2.10.0 [info] Available Plugins: play.Project, sbt.PlayProject, com.typesafe.sbteclipse.plugin.EclipsePlugin, com.typesafe.sbtidea.SbtIdeaPlugin [info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
Am I doing something terribly wrong? Any help would be greatly appreciated, as this is my first Play 2 project!
Update: I forgot to mention that I also have an iOS client that automatically creates JSON using AFNetworking, and I also get an invalid JSON response there. So this is not like invalid JSON calling this ...