Skip to content

Instantly share code, notes, and snippets.

@batmat
Created February 12, 2016 12:41
Show Gist options
  • Save batmat/52564560891360b9737d to your computer and use it in GitHub Desktop.
Save batmat/52564560891360b9737d to your computer and use it in GitHub Desktop.
Sample Groovy code to transform a Map into a Json output
def someMap = [
'key1': "value",
'key2': 142.1
]
def json = new groovy.json.JsonBuilder()
json rootKey: someMap
println "json output: "
println groovy.json.JsonOutput.prettyPrint(json.toString())
@reysmerwvr
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment