

 O Amazon Redshift não permitirá mais a criação de UDFs do Python a partir do Patch 198. As UDFs do Python existentes continuarão a funcionar normalmente até 30 de junho de 2026. Para ter mais informações, consulte a [publicação de blog ](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/). 

# Função IS\$1VALID\$1JSON
<a name="IS_VALID_JSON"></a>

**nota**  
CAN\$1JSON\$1PARSE e suas funções associadas analisam valores JSON como SUPER, que o Amazon Redshift analisa com maior eficiência do que VARCHAR.  
 Em vez de usar IS\$1VALID\$1JSON, recomendamos validar suas strings JSON usando o [Função CAN\$1JSON\$1PARSE](CAN_JSON_PARSE.md). 

A função IS\$1VALID\$1JSON valida uma string JSON. A função retornará um valor booliano `true` se a string tiver um formato JSON válido ou `false` se a string for inválida. Para validar uma matriz JSON, use [Função IS\$1VALID\$1JSON\$1ARRAY](IS_VALID_JSON_ARRAY.md)

Para obter mais informações, consulte [Funções JSON](json-functions.md). 

## Sintaxe
<a name="IS_VALID_JSON-synopsis"></a>

```
IS_VALID_JSON('json_string')
```

## Argumentos
<a name="IS_VALID_JSON-arguments"></a>

 *json\$1string*  
Uma string ou uma expressão que retorna uma string JSON.

## Tipo de retorno
<a name="IS_VALID_JSON-return"></a>

`BOOLEAN`

## Exemplos
<a name="IS_VALID_JSON-examples"></a>

Para criar uma tabela e inserir strings JSON para fins de teste, use o exemplo a seguir.

```
CREATE TABLE test_json(id int IDENTITY(0,1), json_strings VARCHAR);

-- Insert valid JSON strings --
INSERT INTO test_json(json_strings) VALUES
('{"a":2}'), 
('{"a":{"b":{"c":1}}}'), 
('{"a": [1,2,"b"]}');

-- Insert invalid JSON strings --
INSERT INTO test_json(json_strings) VALUES
('{{}}'), 
('{1:"a"}'), 
('[1,2,3]');
```

Para validar as strings no exemplo anterior, use o exemplo a seguir.

```
SELECT id, json_strings, IS_VALID_JSON(json_strings) 
FROM test_json
ORDER BY id;

+----+---------------------+---------------+
| id |    json_strings     | is_valid_json |
+----+---------------------+---------------+
|  0 | {"a":2}             | true          |
|  4 | {"a":{"b":{"c":1}}} | true          |
|  8 | {"a": [1,2,"b"]}    | true          |
| 12 | {{}}                | false         |
| 16 | {1:"a"}             | false         |
| 20 | [1,2,3]             | false         |
+----+---------------------+---------------+
```