# IsJson - funzione dello script e del grafico

IsJson() verifica se una stringa specificata contiene dati JSON (JavaScript Object Notation) validi. È anche possibile convalidare un tipo specifico di dati JSON.

Sintassi:

value IsJson(json [, type])

Tipo di dati restituiti: duale

Argomenti

| Argomento | Descrizione |
| --- | --- |
| json | Stringa da testare. Può contenere spazi extra o nuove righe. |
| type | Argomento opzionale che specifica il tipo di dati JSON da testare.<br><br><ul> <li> <p>'value' (predefinito)</p> </li> <li> <p>'object'</p> </li> <li> <p>'array'</p> </li> <li> <p>'stringa'</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)

#### Esempio: JSON e tipo validi

| Esempio | Risultato |
| --- | --- |
| `IsJson('null')` | Restituisce -1 (true) |
| `IsJson('"abc"', 'value')` | Restituisce -1 (true) |
| `IsJson('"abc"', 'string')` | Restituisce -1 (true) |
| `IsJson(123, 'number')` | Restituisce -1 (true) |

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

#### Esempio: JSON e tipo non validi

| Esempio | Risultato | Descrizione |
| --- | --- | --- |
| `IsJson('text')` | Restituisce 0 (false) | 'text' non è un valore JSON valido |
| `IsJson('"text"', 'number')` | Restituisce 0 (false) | '"text"' non è un numero JSON valido |
| `IsJson('"text"', 'text')` | Restituisce 0 (false) | 'text' non è un tipo JSON valido |

Vedere anche:

* [JsonGet - funzione dello script e del grafico](https://help.qlik.com/it-IT/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/JsonGet.htm)

* [JsonSet - funzione dello script e del grafico](https://help.qlik.com/it-IT/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/JsonSet.htm)