首页 > 解决方案 > SQL Server - JSON 类型枚举

问题描述

给定

declare @json varchar(max)='{
"name":"John",
"age":30,
"cars": [
    { "make":"Ford", "models":[ "Fiesta", "Focus", "Mustang","Vintage"] ,"price":[1100,200,300,999]},
    { "make":"BMW", "models":[ "320", "X3", "X5" ] },
    { "make":"Fiat", "models":[ "500", "Panda" ] }
] }';

查询

select * from openjson(@json,'$')

返回 3 列:

key value   type

我还没有找到类型列值及其对应含义的枚举。

请指出我正确的方向;谢谢。

标签: sqljsonsql-server

解决方案


从 OPENJSON 的 MSDN 页面:

Value of the Type column    JSON data type
0                           null
1                           string
2                           int
3                           true/false
4                           array
5                           object

推荐阅读