# \[] (array construction)

[Read this page in HTML](https://www.scopedb.io/docs/reference/functions/semi-structured-data/array_construct)

Constructs an array from values of any type.

## Syntax

```scopeql
[]
[<value>, ...]
```

## Arguments

| Argument  | Type     | Description                                                          |
| --------- | -------- | -------------------------------------------------------------------- |
| `<value>` | Any type | Zero or more elements. Types may differ; NULL elements are retained. |

## Returns

Returns `array`. With no elements, returns `[]`.

## Examples

### Collect event labels

Combine fields from a request event into an array of labels:

```scopeql
VALUES ('checkout', 'timeout')
SELECT $0 AS service, $1 AS error
SELECT [service, error] AS labels
```

```text
+------------------------+
| labels                 |
+------------------------+
| ["checkout","timeout"] |
+------------------------+
```

### Keep structured steps in an event

An array can also contain objects. Keep the name and duration together for each checkout step:

```scopeql
SELECT [
    {'step': 'cart', 'duration_ms': 80},
    {'step': 'payment', 'duration_ms': 245}
] AS steps
```

The `steps` value:

```text
[
  {
    "duration_ms": 80,
    "step": "cart"
  },
  {
    "duration_ms": 245,
    "step": "payment"
  }
]
```
