title: SQL to JSON - Grouping Results into JSON Array combine columns
body: <p>In SQL Server I have a table with columns (a, b, c, name1, address1, phonenumber1, name2, address2, phonenumber2). I want to  generate JSON for a row like:</p>
  <pre><code>{
     &quot;a&quot; : value_column_a,
     &quot;b&quot; : value_column_b,
     &quot;c&quot; : value_column_c,
     &quot;contacts&quot;: [
  {
    &quot;name&quot; : name1,
    &quot;phone_num&quot;: phonenumber1,
     &quot;address&quot;: address1
  },
  {
    &quot;name&quot; : name2,
    &quot;phone_num&quot;: phonenumber2,
     &quot;address&quot;: address2
  }
  
     ]
  }
  </code></pre>
  <p>Please, help me! I took some hours, but I could not solved it.</p>