I am sending a JSON message via XHR in a post request (content type: application/json; charset=UTF-8 – I am using firefox/chrome).
However, I am unable to process/receive the JSON message in the play 1,.2.3 controller – probably due to pilot error. Any insights/working example would be appreciated – thanks
JSON message (validates successfully in JSONLint):
{"email":"admin1@test.com","password":"admin123"}
Should I be looking at TypeBinder or create the object from the request parameters?
I ended up iterating through request.params.allSimple in order to get the value via request.params.get. I used the JsonParser().parse on this value to get the JSONElement. I then used getAsJsonObject() on the JSONElement to get the JSONBody. I retrieved the needed JSONElements through a get call on the JSONBody & then a getAs method call to get to the actual value. I will investigate TypeBinders in more detail – any other suggestions would be most welcome.