Taken care of scenarios where type mismatch happens, JSON contains too many fields or JSON is missing fields.
Encode will ignore None attributes in an object.