Selected list properties to JSON in C#
<p>I have a list with 8 properties and values. But I would like to get only some of them where IOType=="O" and convert to json format.</p>

<p><a href="https://i.stack.imgur.com/89e0z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/89e0z.png" alt="list"></a></p>

<p>If i use like LINQ</p>

<pre><code>excelIO.Where(m =&gt; m.IOType == "O").Select(m =&gt; new ExcelBo { InterfaceColId = m.InterfaceColId, IOValue = m.IOValue }).ToList();
return JsonConvert.SerializeObject(excelBoList);
</code></pre>

<p>Current output</p>

<pre><code>[{"FunctionWBId":0,"ExcelCellNo":null,"IOType":null,
"InterfaceColId":"txtPrmServicTaxAmt","IOValue":"0.00","DataType":null,
"Status":null,"FunctionWBMap":null},
    {"FunctionWBId":0,"ExcelCellNo":null,"IOType":null,
"InterfaceColId":"txtPrmStampDutyAmt","IOValue":"10.00",
"DataType":null,"Status":null,"FunctionWBMap":null}]
</code></pre>

<p>Desired output : "InterfaceColId" value will be a String and 'IOValue" value will be a value.</p>

<pre><code>[{"txtPrmServicTaxAmt":"0.00","txtPrmStampDutyAmt" :"10.00"}]
</code></pre>

<p>Please help me to give desired ouput?</p>