import groovy.json.JsonOutput;
def json = JsonOutput.toJson([foo: 'bar', baz: [1]])
assert json == '{"foo":"bar","baz":[1]}'
In addition to maps, lists and primitives groovy.json.JsonOutput also supports a POJOs serialitzation:
import groovy.json.JsonOutput;
...