i have a method in my service to save a date in my server, when this method sends the date to the server, it sends same fields as null in the json, how can i remove the fields with null value?
public create<T>(post: any): Observable<T> {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
};
return this.httpClient
.post<T>(`${this.url}`, JSON.stringify(post), httpOptions)
.pipe(catchError((err, source) => this.responseHandler.onCatch(err, source)));
}
the json send to server:
{
"name": "test",
"professionType":{
"id": null
},
"comment": null,
"organizationSpecialities":[
{
"speciality":{
"id": null
},
"effective": 2,
"effectiveDate":{
"startDate": null,
"endDate": "2019/12/01"
}
}
]
}
the json i want to send:
{
"name": "test",
"organizationSpecialities":[
"effective": 2,
"effectiveDate":{
"endDate": "2019/12/01"
}
}
]
}