> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for CHECK_JSON function

# CHECK_JSON

Returns `NULL` if the input string is a valid JSON document or `NULL`.
Otherwise, returns an error message.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
CHECK_JSON(<json_string>)
```

## Parameters

| Parameter       | Description                     | Supported input types |
| :-------------- | :------------------------------ | :-------------------- |
| `<json_string>` | The string to validate as JSON. | `TEXT`                |

## Return Type

The `CHECK_JSON` function returns a result of type `TEXT`.

## Remarks

If you don't care about the error message, you can also use the [`JSON_IS_VALID`](/reference-sql/functions-reference/json/json-is-valid) function.

## Examples

**Example**

The following code example validates a simple JSON string. Returns `NULL` because the input string is valid JSON.

<div className="query-window">
  ```
  SELECT CHECK_JSON('{"name": "John"}');
  ```

  | check\_json <span>text null</span> |
  | :--------------------------------- |
  | NULL                               |

  <p><span>Rows: 1</span><span>Execution time: 5.15ms</span></p>
</div>

**Example**

The following code example validates a simple JSON string. Returns an error message because the input string is invalid JSON as it contains two JSON objects next to each other.

<div className="query-window">
  ```
  SELECT CHECK_JSON('{"name": "John"}{"name": "John"}');
  ```

  | check\_json <span>text null</span>                                                                                  |
  | :------------------------------------------------------------------------------------------------------------------ |
  | TAPE\_ERROR: The JSON document has an improper structure: missing or superfluous commas, braces, missing keys, etc. |

  <p><span>Rows: 1</span><span>Execution time: 4.89ms</span></p>
</div>
