title: How to force SQL Server to return empty JSON array
body: <p>I'm using SQL Server 2016, which supports <code>JSON PATH</code> to return JSON string.
  I wonder how to get just a simple empty json array, I mean <code>[]</code> when my query or sub-query returns null. I've tried this query:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT '' AS TEST
  FOR JSON PATH,ROOT('arr')
  </code></pre>
  <p>which returns:</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;arr&quot;:[{&quot;test&quot;:&quot;&quot;}]}
  </code></pre>
  <p>and also this one:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT NULL AS TEST
  FOR JSON PATH,ROOT('arr')
  </code></pre>
  <p>which returns:</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;arr&quot;:[{}]}
  </code></pre>
  <p>it's better but still not correct, I need this:</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;arr&quot;:[]}
  </code></pre>