Skip to content

Instantly share code, notes, and snippets.

@mlist
Created December 13, 2013 12:34
Show Gist options
  • Save mlist/7943608 to your computer and use it in GitHub Desktop.
Save mlist/7943608 to your computer and use it in GitHub Desktop.
grails with jackson
def criteria = SomeDomainClass.createCriteria()
def result = criteria.list {
...
}
ObjectMapper mapper = new ObjectMapper()
def jsonResult = mapper.writeValueAsString(result)
response.contentType = "text/json"
render jsonResult
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment