Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails JSON Converters and transient properties

Tags:

grails

groovy

Using Grail 1.3.7 I found that the JSON converter ignores transient properties of Domain objects. Question: Is there an elegant way to work around this obstacle.

Bonus question: what's the reasoning behind excluding calculated fields(transient props) from being sent to the response????

like image 332
dbrin Avatar asked Jul 19 '11 05:07

dbrin


1 Answers

what works for me is this one line

def jsonobj=domobj.properties as JSON
like image 86
Vlad Avatar answered Sep 25 '22 19:09

Vlad