# IsJson – função de script e gráfico

IsJson() testa se uma string especificada contém dados JSON (JavaScript Object Notation) válidos. Você também pode validar um tipo de dados JSON específico.

Sintaxe:

value IsJson(json [, type])

Tipo de dados de retorno: dual

Argumentos

| Argumento | Descrição |
| --- | --- |
| json | String a ser testada. Pode conter espaços extras ou novas linhas. |
| type | Argumento opcional que especifica o tipo de dados JSON a ser testado.<br><br><ul> <li> <p>'value' (padrão)</p> </li> <li> <p>'object'</p> </li> <li> <p>'array'</p> </li> <li> <p>'string'</p> </li> <li> <p>'number'</p> </li> <li> <p>'Boolean'</p> </li> <li> <p>'null' </p> </li> </ul> |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/IsJson.htm)

#### Exemplo: JSON e tipo válidos

| Exemplo | Resultado |
| --- | --- |
| `IsJson('null')` | Retorna -1 (true) |
| `IsJson('"abc"', 'value')` | Retorna -1 (true) |
| `IsJson('"abc"', 'string')` | Retorna -1 (true) |
| `IsJson(123, 'number')` | Retorna -1 (true) |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/IsJson.htm)

#### Exemplo: JSON ou tipo inválido

| Exemplo | Resultado | Descrição |
| --- | --- | --- |
| `IsJson('text')` | Retorna 0 (false) | 'text' não é um valor JSON válido |
| `IsJson('"text"', 'number')` | Retorna 0 (false) | '"text"' não é um número JSON válido |
| `IsJson('"text"', 'text')` | Retorna 0 (false) | 'text' não é um tipo JSON válido |

Consulte também:

* [JsonGet – função de script e gráfico](https://help.qlik.com/pt-BR/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/JsonGet.htm)

* [JsonSet – função de script e gráfico](https://help.qlik.com/pt-BR/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/JsonSet.htm)