My Grails app includes an action that expects the following JSON data to be sent via HTTP POST
{email: '[email protected]'}
Currently I retrieve the value of the email like so
def foo() {
def json = request.JSON
String email = json.email
// remainder of action omitted
}
If the data were being sent via URL parameters instead, I could bind it by name to an action argument like so:
def foo(String email) {
// remainder of action omitted
}
Is it possible to bind JSON in the request body to action arguments directly, or is this facility limited to URL and form parameters?