How fields decorated with transient in grails entity classes are displayed in as JSON

this is a very strange problem, which is to use the keyword transient in the entity class to modify the attribute, which is not displayed when as JSON.

clipboard.png

clipboard.png

as JSON

clipboard.png

doesn"t output these attributes. What"s going on?

Mar.03,2021

as json serializes entity objects. Adding transient means that this property does not allow serialization. There should be no


you didn't assign a value, did you? Also, you don't need a field like transients at all, you can use:

domain.list().collect {
    [
        id: it?.id,
        name: it?.xxx
    ]
}

whatever you want to encapsulate in this

Menu