IS_OBJECT (Azure Cosmos DB)IS_OBJECT (Azure Cosmos DB)

返回一个布尔值,指示指定表达式的类型是否为 JSON 对象。Returns a Boolean value indicating if the type of the specified expression is a JSON object.

语法Syntax

IS_OBJECT(<expr>)  

参数Arguments

exprexpr
是任何表达式。Is any expression.

返回类型Return types

返回一个布尔表达式。Returns a Boolean expression.

示例Examples

以下示例使用 IS_OBJECT 函数检查 JSON 布尔、数字、字符串、null、对象、数组和 undefined 类型的对象。The following example checks objects of JSON Boolean, number, string, null, object, array, and undefined types using the IS_OBJECT function.

SELECT   
    IS_OBJECT(true) AS isObj1,   
    IS_OBJECT(1) AS isObj2,  
    IS_OBJECT("value") AS isObj3,   
    IS_OBJECT(null) AS isObj4,  
    IS_OBJECT({prop: "value"}) AS isObj5,   
    IS_OBJECT([1, 2, 3]) AS isObj6,  
    IS_OBJECT({prop: "value"}.prop2) AS isObj7  

下面是结果集。Here is the result set.

[{"isObj1":false,"isObj2":false,"isObj3":false,"isObj4":false,"isObj5":true,"isObj6":false,"isObj7":false}]

备注Remarks

此系统函数将从范围索引中获益。This system function will benefit from a range index.

后续步骤Next steps