漂亮的打印 json 字符串
import groovy.json.JsonOutput;
def json = JsonOutput.toJson([foo: 'bar', baz: [1]])
assert json == '{"foo":"bar","baz":[1]}'
def pretty = JsonOutput.prettyPrint(json)
assert pretty == '''{
"foo": "bar",
"baz": [
1
]
}'''