title: Consuming JSON in SQL Server 2012
body: <p>I'm working on a project in which I need the ability to receive and consume (i.e. extract information) from received JSONs. The current version of SQL Server I am using (and will not change for the next couple of years) is 2012, which does not include support for this (as opposed to version 2016).</p>
  
  <p>I do recall seeing a post from someone in which he gently offered a source code for this, but unfortunately can't find it again.</p>
  
  <p>The idea is to have something like:</p>
  
  <p>Having the following JSON:</p>
  
  <pre><code>{
      "Obj1": {
          "Obj1_S_1": [{
              "Obj1_S_1_S_1": "Blabla_1"
          }, {
              "Obj1_S_1_S_1": "Blabla_2"
          }, {
              "Obj1_S_1_S_1": "Blabla_3"
          }, {
              "Obj1_S_1_S_1": "Blabla_4"
          }, {
              "Obj1_S_1_S_1": "Blabla_5"
          }, {
              "Obj1_S_1_S_1": "Blabla_6"
          }]
      },
      "Obj2": "This is a simple string",
      "Obj3": "456.33"
  }
  </code></pre>
  
  <p>I could use the following invocation:</p>
  
  <pre><code>SET @My_Param = GET_JSON(@Source_JSON, '*.Obj1.Obj1_S_1[3].Obj1_S_1_S_1') ;
  </code></pre>
  
  <p>and I would get the value <code>'Blabla_4'</code> into the variable <code>@My_Param</code>.</p>
  
  <p>This is the very same syntax used in Oracle and MySQL by the way.</p>