How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?
this works for me :
import groovy.json.JsonBuilder properties = new Properties() properties.put("name", "zhangsan") println new JsonBuilder(properties).toPrettyString()