I\'m pretty used to Grails converters, where you can convert any object to a JSON representation just like this (http://grails.org/Converters+Reference)
return f
I couldn't get the other answers to work within the evaluate console in Intellij so...
groovy.json.JsonOutput.toJson(myObject)
This works quite well, but unfortunately
groovy.json.JsonOutput.prettyString(myObject)
didn't work for me.
To get it pretty printed I had to do this...
groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(myObject))