# {} (object construction)

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

Constructs an object from string keys and values of any type.

## Syntax

```scopeql
{}
{<key>: <value>, ...}
```

## Arguments

| Argument  | Type     | Description                                              |
| --------- | -------- | -------------------------------------------------------- |
| `<key>`   | `string` | Key expression. Pairs with a NULL key are skipped.       |
| `<value>` | Any type | Value associated with the key. NULL values are retained. |

## Returns

Returns `object`. With no pairs, returns `{}`. Each key occurs once; if keys repeat, the last value is kept.

## Examples

Build an object from request fields, with the status and duration grouped under `outcome`:

```scopeql
VALUES ('req-17', 'checkout', 504, 1200)
SELECT $0 AS request_id, $1 AS service, $2 AS status, $3 AS latency_ms
SELECT {
    'request_id': request_id,
    'outcome': {'status': status, 'latency_ms': latency_ms},
    'context': {'service': service}
} AS finding
```

The `finding` value:

```text
{
  "context": {
    "service": "checkout"
  },
  "outcome": {
    "latency_ms": 1200,
    "status": 504
  },
  "request_id": "req-17"
}
```
