使用 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 "}
         ]
}