Is it possible to serialize an object using toJson(object) and have the toJson-parser ignore certain methods?
We have a method in a User class (getSocial – which is concerned with Facebook integration) that makes the toJson()-parsing fail – and we’d like it go ignore that method when serializing if possible.
Can this be done?
You can just iterate the object and rewrite it to
MaporListwith specified values only.Note that if you are choosing your objects with Ebean it fetches whole object, also data, which shouldn’t be fetched (as password or other credentials)