I am trying to render a json response from grails controller action. Here is my code:
render ([message:"voila Sent Successfully!"]) as JSON
But in the gsp, it is rendering like:
['message':'Email Sent Successfully!']
Above text is actually a string(as its typeof in jquery ajax call gives a string in the success event handler), so how do I render it as a JSON?
I am using grails 2.4.5 and the JSON class is actually grails.converters.JSON (not grails.converters.deep.JSON)
Just do as
render ([message:"voila Sent Successfully!"] as JSON )
i.e inserting as JSON
within parentheses.