Any of those help The value you get back from your method is a grails.converters.JSON, which is not a directly accessible JSON tree as such, but simply an object that knows how to serialize itself as JSON when required. If you want direct access to the JSON tree structure then you need to tell the grails.converters.JSON object to serialize itself and then pass that JSON to JSON.parse to turn it into a JSONElement (or one of its subclasses, in this case presumably a JSONObject).
Grails/Groovy adding properties to existing Java class, losing them when trying to serialize using JSON converter?
By : Alec De Ruiter
Date : March 29 2020, 07:55 AM
like below fixes the issue I think the JSON conversion in grails does not pick up dynamically added properties. Maybe you should register your own object marshaller for the class in question?