Notă
Accesul la această pagină necesită autorizare. Puteți încerca să vă conectați sau să modificați directoarele.
Accesul la această pagină necesită autorizare. Puteți încerca să modificați directoarele.
The STRINGTOARRAY function converts a string expression to an array.
An Azure Cosmos DB system function that returns a string expression converted to an array.
Syntax
STRINGTOARRAY(<string_expr>)
Arguments
| Description | |
|---|---|
string_expr |
A string expression. |
Return types
Returns an array.
Examples
This section contains examples of how to use this query language construct.
Convert string to array
In this example, the STRINGTOARRAY function is used to parse various string values into arrays.
SELECT VALUE {
parseEmptyArray: STRINGTOARRAY("[]"),
parseArray: STRINGTOARRAY('[ "coats", "gloves", "hats" ]'),
complexArray: STRINGTOARRAY('[ { "types": [ "coats", "gloves" ] }, [ "hats" ], 76, false, null ]'),
nestedArray: STRINGTOARRAY('[ [ "coats", "gloves" ], [ "hats" ] ]'),
invalidArray: STRINGTOARRAY("[ 'coats', 'gloves', 'hats' ]"),
parseUndefined: STRINGTOARRAY(undefined),
parseNull: STRINGTOARRAY(null)
}
[
{
"parseEmptyArray": [],
"parseArray": [ "coats", "gloves", "hats" ],
"complexArray": [
{
"types": [ "coats", "gloves" ]
},
[ "hats" ],
76,
false,
null
],
"nestedArray": [
[ "coats", "gloves" ],
[ "hats" ]
]
}
]
Remarks
- This function doesn't utilize the index.