You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an object of type User that has an attribute also of type User:
class User {
String name;
User user;
}
If I try to remove not directly the user attribute, but the user of the inner user, the generated json does not have any references to user. For instance:
No. Actually my goal was to exclude just the "user of the user". I have this:
User a = new User();
User b = new User();
b.setUser(a);
User c = new User();
c.setUser(b);
If I try to serialize "user c", in recursive mode, it would serialize the information of "user b" and indirectly of "user a" too. If I want to remove the information just of the "user a", I think it's impossible.
I just had a look at ExclusionStrategy interface of Gson, but apparently there isn't enough context there to do this kind of exclusion. Maybe it's better to do this directly in the app.
It's better to explain with this example:
Given an object of type User that has an attribute also of type User:
If I try to remove not directly the user attribute, but the user of the inner user, the generated json does not have any references to user. For instance:
I expected to have something like:
But I actually have:
Vraptor removes any references to user, not just the requested one.
The text was updated successfully, but these errors were encountered: