Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
The STRINGTOARRAY function converts a string expression to an array.
An Azure Cosmos DB for NoSQL 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.