title: Create json object and aggregate into json array in SqlServer
body: <p>I have following query in ORACLE:</p>
  
  <pre><code>SELECT *
  FROM "Supplier" s
  OUTER APPLY( 
      SELECT JSON_ARRAYAGG(JSON_OBJECT(p."Id", p."Description", p."Price")) as "Products"
      FROM "Products" p
      WHERE p."SupplierId" = s."Id"
  ) sp
  </code></pre>
  
  <p>In <code>OUTER APPLY</code> subquery I am creating json from columns I need and then aggregating those objects into json array. I need those two functions because sometimes I use only one of them. The same operation I would like to do in SqlServer. This is solution I managed so far:</p>
  
  <pre><code>SELECT *
  FROM "Supplier" as s
  OUTER APPLY(
      SELECT p."Id", p."Description", p."Price"
      FROM "Products" as p
      WHERE p."SupplierId" = s."Id"
      FOR JSON PATH
  ) as sp("Products")
  </code></pre>
  
  <p>The problem is that SqlServer executing those two functions at once (this is purpose for <code>FOR JSON PATH</code> statement). So here are my questions:</p>
  
  <p>1) Is there possible to create json object without wrapping it into array (oracle-like syntax)?</p>
  
  <p>2) Is there possible to aggregate json objects into an array?</p>
  
  <p><strong>UPDATE</strong>
  I am using SqlServer version 2019 15.0.2000.5</p>
  
  <p>Expected result (single record of products in json format)</p>
  
  <pre><code>"Products":{
      "Id":"FEB0646B709B45B5A306E10599716F28",
      "Description":"Database Manager",
      "Price":149.99
  }
  </code></pre>