> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_object.md).

# JSON\_OBJECT

## Syntax

```bnf
JSON_OBJECT([key, value[, key, value] ...])
```

## Description

Returns a JSON object containing the given key/value pairs. The key/value list can be empty.

An error will occur if there are an odd number of arguments, or any key name is `NULL`.

## Example

```sql
SELECT JSON_OBJECT("id", 1, "name", "Monty");
+---------------------------------------+
| JSON_OBJECT("id", 1, "name", "Monty") |
+---------------------------------------+
| {"id": 1, "name": "Monty"}            |
+---------------------------------------+
```

## See also

* [JSON\_MAKE\_OBJECT](/docs/server/server-usage/storage-engines/connect/connect-table-types/connect-json-table-type.md#json_make_object), the CONNECT storage engine function

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
