ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.How to set NULL in JSON object in C#<p>In Json you need to leave it blank and if integer then 0.</p>https://www.aspforums.net:443/Threads/136761/How-to-set-NULL-in-JSON-object-in-C/https://www.aspforums.net:443/Threads/136761/How-to-set-NULL-in-JSON-object-in-C/Wed, 28 Mar 2018 07:32:15 GMTHow to set NULL in JSON object in C#<p>Finally, I found a workaround. In my SqlCommand, I changed this:</p> <pre class="brush: csharp">cmd.Parameters.AddWithValue(&#34;@fkidregion&#34;, fkidregion);</pre> <p>to this:&nbsp;</p> <pre class="brush: csharp">cmd.Parameters.AddWithValue(&#34;@fkidregion&#34;, fkidregion != &#34;&#34; ? fkidregion : Convert.DBNull);</pre> <p>Now the NULL is well interpreted by the query.&nbsp;</p> <p>Thank you for your time.</p>https://www.aspforums.net:443/Threads/136761/How-to-set-NULL-in-JSON-object-in-C/https://www.aspforums.net:443/Threads/136761/How-to-set-NULL-in-JSON-object-in-C/Mon, 02 Apr 2018 13:49:50 GMT