I am calling an GET API, where is am getting account details like name, number, ext Id etc. For parsing the response, i created a class like below.
public class AccWrp {
public String customer_no;
public String customer_name;
public String extId;
}
Now in one post call i need to send Account details(after upsert) with some extra fields, like isActive, Email, Phone, Fax. I thought i will use same class for sending data back, as they are expecting same attributes in the JSON as above. So i added other fields as well.
public class AccWrp {
public String customer_no;
public String customer_name;
//used in post call
public String email;
public String phone_no;
public String fax_no;
public Boolean is_active;
}
But when i am using this AccWrp class instance in post call. Properties which are not used is going as null. like
"customer_name": null, "customer_no" : null
Is there any way i can have only one class for parsing and for POST call without sending other properties as null.
Is there any way, i can have only one class?
Thanks, Manohar