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 OBJECTTOARRAY function converts field/value pairs in a JSON object to a JSON array.
Syntax
OBJECTTOARRAY(<object_expr> [, <string_expr_1>, <string_expr_2>])
Arguments
| Description | |
|---|---|
object_expr |
An object expression with properties in field/value pairs. |
string_expr_1 |
A string expression with a name for the field representing the field portion of the original field/value pair. |
string_expr_2 |
A string expression with a name for the field representing the value portion of the original field/value pair. |
Return types
Returns an array of elements with two fields, either k and v or custom-named fields.
Examples
This section contains examples of how to use this query language construct.
Convert object to array
In this example, the OBJECTTOARRAY function is used to convert a JSON object to an array.
SELECT VALUE
OBJECTTOARRAY({
"a": "12345",
"b": "67890"
})
[
[
{
"k": "a",
"v": "12345"
},
{
"k": "b",
"v": "67890"
}
]
]