I have some data in Groovy's objects which I need to convert to a JSON string array. The final result should be..
"message": "Hello, is it me you are looking for?"
def deJson = [
] as grails.converters.JSON
JSON is specific to Grails (as mentioned in one of the comments in the answer from the previous post). You should have followed the question itself in the post, that has the answer.
groovy.json.JsonBuilder, the expected way to serialize would be:
def jsonObj = [ keys: [ passcode: secretCode ], values: [ EmailAddress:emailData.to, message: content.message ] ] // In order to get a json array, use a list containing the object new JsonBuilder([jsonObj]).toPrettyString()