> 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_set.md).

# JSON\_SET

## Syntax

```bnf
JSON_SET(json_doc, path, val[, path, val] ...)
```

## Description

Updates or inserts data into a JSON document, returning the result, or `NULL` if any of the arguments are `NULL` or the optional path fails to find an object.

An error will occur if the JSON document is invalid, the path is invalid or if the path contains a `*` or a wildcard\*\*.\*\*

`JSON_SET` can update or insert data, while [JSON\_REPLACE](/docs/server/reference/sql-functions/special-functions/json-functions/json_replace.md) can only update, and [JSON\_INSERT](/docs/server/reference/sql-functions/special-functions/json-functions/json_insert.md) only insert.

## Examples

```sql
SELECT JSON_SET(Priv, '$.locked', 'true') FROM mysql.global_priv
```

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

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