-
Notifications
You must be signed in to change notification settings - Fork 16
Serialize & Deserialize when the class attribute is null #25
Copy link
Copy link
Open
Description
When you have a class with a null vale in some attribute, custom property name in serialization and deserialization processs not work, and json property name is ignored.
Examples are in TypeScript Syntax
Ex. User Domain Class
export class User {
@JsonProperty({name: "id"})
public _id: number;
@JsonProperty({name: "name"})
public _name: string;
@JsonIgnore()
public _password: string;
public constructor() {
this._id = null;
this._name = "Test User Name";
this._password = "gsa@aglaX!";
}
}
Ex. Serialization
let userInstance: User;
userInstance = ObjectMapper.serialize(singleTestDTO);
User instance: {"_id": null, "name": "Test User Name"}
If don't explicitly initialize _id to null, works, or if initialize to undefined, but no with null value...
It would be wonderful it worked with null values
Congratulations on working with module! 👍
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels