def index() {
def all = Product.list()
withFormat {
json {
JSON.use("deep"){
def c = all as JSON
c.prettyPrint = true
render c
}
}
xml {
XML.use("deep"){
render all as XML
}
}
}
}
After figuring this out I also discovered the JSON View extension for Chrome, which negated my need for pretty printing JSON.
Showing posts with label grails. Show all posts
Showing posts with label grails. Show all posts
Friday, February 22, 2013
Grails pretty print using deep JSON Converter
Here's a simple little Grails code sample to enable pretty printing on your JSON Converter when using the deep option:
Subscribe to:
Posts (Atom)