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
Written by Luca Borzani
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#