title: Pass JSON directly to SQL Server 2016
body: <p>I would like to pass an JSON object to a SQL Server 2016 stored procedure without deserializing the object and let the database process the data.  </p>
  
  <p>I'm passing in:</p>
  
  <pre><code>DECLARE @json NVarChar(2048) = N'[{
      "PMID": "31390573",
      "pubdate": "2019",
      "data": {
          "memberID": "1692",
          "pmid": "31390573",     
          "sortpubdate": "2019/08/06 00:00",
          "pmc": "PMC6733019"
      }
  }, {
      "PMID": "31213464",
      "pubdate": "2019",
      "data": {
          "memberID": "1692",
          "pmid": "31213464",     
          "sortpubdate": "2019/08/15 00:00",
          "pmc": "PMC6753942"
      }
  }, {
      "PMID": "31130363",
      "pubdate": "2019",
      "data": {
          "memberID": "1692",
          "pmid": "31130363",     
          "sortpubdate": "2019/06/20 00:00",
          "pmc": "PMC6588466"
      }
  }]'
  </code></pre>
  
  <p>If I use </p>
  
  <pre><code>SELECT * FROM OPENJSON(@json);
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>0   {   "PMID": "31390573",   "pubdate": "2019",   "data": {    "memberID": "1692",    "pmid": "31390573",      "sortpubdate": "2019/08/06 00:00",    "pmc": "PMC6733019"   }  }    5
  1   {   "PMID": "31213464",   "pubdate": "2019",   "data": {    "memberID": "1692",    "pmid": "31213464",      "sortpubdate": "2019/08/15 00:00",    "pmc": "PMC6753942"   }  }    5
  2   {   "PMID": "31130363",   "pubdate": "2019",   "data": {    "memberID": "1692",    "pmid": "31130363",      "sortpubdate": "2019/06/20 00:00",    "pmc": "PMC6588466"   }  }    5
  </code></pre>
  
  <p>I would like to end up with a table with one column for the items in the data element so a column for memberID  -- pmid --sortpubdate--pmc.</p>
  
  <pre><code>memberID    pmid        sortpubdate
  ------------------------------------------------
  1692        31390573    2019-08-06 00:00:00.0000000
  1692        31213464    2019-08-15 00:00:00.0000000
  1692        31130363    2019-06-20 00:00:00.0000000
  </code></pre>
  
  <p>Is this possible?  If it was XML it could be ripped apart and processed.</p>