Skip to content

Instantly share code, notes, and snippets.

@SpOOnman
Created November 21, 2012 14:15
Show Gist options
  • Save SpOOnman/4125044 to your computer and use it in GitHub Desktop.
Save SpOOnman/4125044 to your computer and use it in GitHub Desktop.
Grails render as JSON catch
$ curl localhost:8080/example/restJsonCatch/grailsJson
{"first":"foo","second":5}
$ curl localhost:8080/example/restJsonCatch/netSfJson
{first=foo, second=5}
class RestJsonCatchController {
def grailsJson() {
render([first: 'foo', second: 5] as grails.converters.JSON)
}
def netSfJson() {
render([first: 'foo', second: 5] as net.sf.json.JSON)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment