title: JSON text is not properly formatted. Unexpected character ''' is found at position 1
body: <p><strong>Question:</strong> Why am I unable to apply the OPENJSON function to read the data below into standard columnar form? How can I modify the query or the JSON text to solve this problem? </p>
  
  <p><strong>Context:</strong> I have some JSON data in a global temp table in SQL Server that I am trying to parse and load into standard table. </p>
  
  <pre><code>SELECT * FROM ##json_loop_tracking;
  </code></pre>
  
  <p>Returns the single row data in the following structure: </p>
  
  <pre><code>{'sends': 0, 'opens': 0, 'clicks': 0, 'forwards': 0, 'unsubscribes': 0, 'bounces': 0, 'spam_count': 0}
  </code></pre>
  
  <p>When trying to apply the OPENJSON function in code block below I get the following error:</p>
  
  <blockquote>
    <p>Msg 13609, Level 16, State 4, Line 51
    JSON text is not properly formatted. Unexpected character ''' is found at position 1.</p>
  </blockquote>
  
  <pre><code>INSERT INTO ##jsonparsed_tracking (
  sends,opens,clicks,forwards,unsubscribes,bounces,spam_count
  )
  SELECT DISTINCT
  jsn.sends, jsn.opens, jsn.clicks, jsn.forwards, jsn.unsubscribes, jsn.bounces,jsn.spam_count
  FROM ##json_loop_tracking
  OUTER APPLY (
  
  SELECT * FROM OPENJSON(##json_loop_tracking.my_json)
  WITH (
      sends int '$.sends',
      opens int '$.opens',
      clicks int '$.clicks',
      forwards int '$.forwards',
      unsubscribes int '$.unsubscribes',
      bounces int '$.bounces',
      spam_count int '$.spam_count'
  )
  
  ) AS jsn
  </code></pre>