Let's say we have an apex class we're using as a wrapper object, with a getter method to return an Id made of some derivation of other properties, like so:
- Return the wrapper type from the @RemoteAction method and let salesforce handle serialization for you.
- Return a pre-serialized JSON string from the method.
But lo and behold there's another difference in there:
the first approach doesn't have an Id property at all!
The lesson in this:
The implicit serialization provided by @RemoteAction results does not run getter methods.
The explicit serialization of apex's JSON.serialize does run getter methods.