Skip to content

Instantly share code, notes, and snippets.

@joasgarcia
Last active August 29, 2015 14:06
Show Gist options
  • Save joasgarcia/7fe892d4b0ddca5118fe to your computer and use it in GitHub Desktop.
Save joasgarcia/7fe892d4b0ddca5118fe to your computer and use it in GitHub Desktop.
Transformar um Map do Groovy para uma string JSON formatada
import groovy.json.JsonBuilder
def data = [
dealDate: new Date().format("yyyy-MM-dd"),
contactId:17628473,
dealTypeId:4698155,
items:[[quantity:1, rate:74.0, itemId:17214256]],
total:74.0
]
println new JsonBuilder(data).toPrettyString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment