C# 在webservice中从响应对象隐藏空值

C# 在webservice中从响应对象隐藏空值,c#,.net,json,web-services,C#,.net,Json,Web Services,我有一个返回对象(响应)的web服务。对象包含依赖于请求类型的参数 我想在响应中隐藏null参数,以便它只返回与提交的请求相关的参数 JSon响应: { "ProcessRequestJsonResult":" { \"RequestTypeId\":0, \"StatusCode\":2010, \"status\":null, \"ResponseMessage\":\"Customer is assosiat

我有一个返回对象(响应)的web服务。对象包含依赖于请求类型的参数

我想在响应中隐藏null参数,以便它只返回与提交的请求相关的参数

JSon响应:

{
    "ProcessRequestJsonResult":" 
    {
        \"RequestTypeId\":0,
        \"StatusCode\":2010,
        \"status\":null,
        \"ResponseMessage\":\"Customer is assosiated with another request\",
        \"ResponseLanguage\":null,
        \"LandLineAreaCode\":null,
        \"LandLine\":null,
        \"LandLineOwner\":null,
        \"Conts\":null,
        \"Ownership\":null,
        \"OwnershipString\":null,
        \"Co\":null,
        \"ContractDate\":\"\\\/Date(-62135596800000)\\\/\",
        \"BillingCycle\":null,
        \"BillingLog\":null,
        \"ActivationDate\":\"\\\/Date(-62135596800000)\\\/\",
        \"FirstLoginDate\":\"\\\/Date(-62135596800000)\\\/\",
        \"CustomerTechnicalDetails\":null,
        \"CustomerQuota\":null,
        \"CustStat\":null,
        \"CurrentStatus\":null,
        \"Case\":null,
        \"CustomerProducts\":null,
        \"CustomerTransaction\":null,
        \"Discount\":null,
        \"IdType\":null,
        \"IdNumber\":null,
        \"Idtables\":null
    }"
}

我想隐藏任何等于null的返回参数。有没有人知道这是否可能

使用什么框架来实现web服务?是ASP.NET MVC/Web API还是WCF?这是一段代码,可以理解“响应中的空参数”的确切含义。如果使用JSON.NET序列化引擎,这可能会很有帮助:@Corwin感谢您的回复,非常有帮助