Groovy, Grails

Serialize a Map as JSON or YAML

When working in a web environment, you often have to transfer arbitrary data like lists or maps as String of the network.

The followin Gist shows how to solve this by serializing a list or map as JSON or YAML. In addition, it shows how Groovy does it an a very elegant and clean way.

First appeared April 6, 2016 on