title: Why is JSON_QUERY sending back a null value?
body: <p>This is driving me nuts, and I don't understand what's wrong with my approach.</p>
  
  <p>I generate a JSON object in SQL like this:</p>
  
  <pre><code>    select @output = (  
           select distinct lngEmpNo, txtFullName
           from tblSecret
           for json path, root('result'), include_null_values
      )
  </code></pre>
  
  <p>I get a result like this:</p>
  
  <pre><code>{"result":[{"lngEmpNo":696969,"txtFullName":"Clinton, Bill"}]}
  </code></pre>
  
  <p><code>ISJSON()</code> confirms that it's valid JSON, and <code>JSON_QUERY(@OUTPUT, '$.result')</code> will return the array <code>[]</code> portion of the JSON object... cool!</p>
  
  <p>BUT, I'm trying to use <code>JSON_QUERY</code> to extract a specific value:</p>
  
  <p>This gets me a <code>NULL</code> value. <strong>Why???????</strong>  I've tried it with the <code>[0]</code>, without the <code>[0]</code>, and of course, <code>txtFullName[0]</code></p>
  
  <pre><code>SELECT JSON_QUERY(@jsonResponse, '$.result[0].txtFullName');
  </code></pre>
  
  <p>I prefixed with <code>strict</code>, <code>SELECT JSON_QUERY(@jsonResponse, 'strict $.result[0].txtFullName');</code>, and it tells me this:</p>
  
  <pre><code>Msg 13607, Level 16, State 4, Line 29
  JSON path is not properly formatted. Unexpected character 't' is found at 
  position 18.
  </code></pre>
  
  <p>What am I doing wrong?  What is wrong with my structure?</p>