spwegg
Last Updated: February 25, 2016
·
1.963K
· lborzani

Grails: Submit JSON objects

Use of jQuery.ajax is assumed:

  • ensure you pass a stringified version of the json object:

    data: JSON.stringify({myObject:'is this'})

  • you'll want to send it in the request body so:

    type: 'POST'

  • read the object in your controller like this:

    def json = request.JSON