I have a rest service that returns a json. Everything is working and i was wondering if i could ignore null values in respose because i don't want to send something like:
{
"name": "George",
"country": null,
"city": null
}
I would like to return something like:
{
"name": "George"
}
The object that represents a Client is like that:
namespace Tests.Domain
{
public class Client
{
public Client() { }
[DataMember]
public string Name{ get; set; }
[DataMember]
public Country Country { get; set; }
[DataMember]
public City City { get; set; }
}
}
And my response is:
...
return Request.CreateResponse((HttpStatusCode)200, clientSession);
Thanks in advance.
David L.