I have a ConfigInstance class which contains a password and a password_hash. Now I want to serialize the object using gson but exclude
ConfigInstance
password
password_hash
If you want to disable only serialization or only deserialization, you can play with @Expose annotation's attributes, e.g.:
@Expose
@Expose(serialize = false, deserialize = true)
Default option is true, so deserialize is unnecessary here.