使用 ROOT 物件包裝結果

Wraps 使用指定的鍵在其他根物件中返回 JSON 陣列:

SELECT top 3 object_id, name, type FROM sys.objects
FOR JSON PATH, ROOT('data')

查詢的結果將是包裝器物件內的 JSON 物件陣列:

{
  "data":[
           {"object_id":3,"name":"sysrscols","type":"S "},
           {"object_id":5,"name":"sysrowsets","type":"S "},
           {"object_id":6,"name":"sysclones","type":"S "}
         ]
}