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

# JSON\_VALID

## Syntax

```bnf
JSON_VALID(value)
```

## Description

Indicates whether the given value is a valid JSON document or not. Returns `1` if valid, `0` if not, and `NULL` if the argument is `NULL`.

{% tabs %}
{% tab title="Current" %}
The `JSON_VALID` function is automatically used as a [CHECK constraint](/docs/server/reference/sql-statements/data-definition/constraint.md#check-constraints) for the [JSON data type alias](/docs/server/reference/data-types/string-data-types/json.md) in order to ensure that a valid json document is inserted.
{% endtab %}

{% tab title="< 10.4.3" %}
The `JSON_VALID` function is **not** automatically used as a [CHECK constraint](/docs/server/reference/sql-statements/data-definition/constraint.md#check-constraints) for the [JSON data type alias](/docs/server/reference/data-types/string-data-types/json.md).
{% endtab %}
{% endtabs %}

## Examples

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

SELECT JSON_VALID('{"id": 1, "name": "Monty", "oddfield"}');
+------------------------------------------------------+
| JSON_VALID('{"id": 1, "name": "Monty", "oddfield"}') |
+------------------------------------------------------+
|                                                    0 |
+------------------------------------------------------+
```

## See Also

* [JSON video tutorial](https://www.youtube.com/watch?v=sLE7jPETp8g) covering JSON\_VALID.

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

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