It seems as if in Grails, the default contentType used to render a JSON response when using something like what follows:
render Book.list(params) as JSON
is application/json
There is of course a more longhanded way to define the content type:
render(contentType:"text/json") {
book(title:b.title,author:b.author)
}
Is there a way to use the shorthand way, and still get a response content-type of “text/json”?
Note: examples taken from here
In your grails
config.groovyyou can set the following mime type properties.Try changing the order of the list of values for the json property to
['text/json','application/json']