# JSON\_TYPE

## Syntax

```sql
JSON_TYPE(json_val)
```

## Description

Returns the type of a JSON value (as a string), or `NULL` if the argument is null.

An error will occur if the argument is an invalid JSON value.

The following is a complete list of the possible return types:

| Return type | Value                                                                                         | Example                   |
| ----------- | --------------------------------------------------------------------------------------------- | ------------------------- |
| ARRAY       | JSON array                                                                                    | \[1, 2, {"key": "value"}] |
| OBJECT      | JSON object                                                                                   | {"key":"value"}           |
| BOOLEAN     | JSON true/false literals                                                                      | true, false               |
| DOUBLE      | A number with at least one floating point decimal.                                            | 1.2                       |
| INTEGER     | A number without a floating point decimal.                                                    | 1                         |
| NULL        | JSON null literal (this is returned as a string, not to be confused with the SQL NULL value!) | null                      |
| STRING      | JSON String                                                                                   | "a sample string"         |

## Examples

```sql
SELECT JSON_TYPE('{"A": 1, "B": 2, "C": 3}');
+---------------------------------------+
| JSON_TYPE('{"A": 1, "B": 2, "C": 3}') |
+---------------------------------------+
| OBJECT                                |
+---------------------------------------+
```

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_type.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
