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

# Is JSON

> Learn how to use the is JSON test

## Definition

The *is JSON* test allows you to check if a specified column contains a valid JSON.

## Taxonomy

* **Task types**: LLM.
* **Availability**: <Tooltip tip="Continuously evaluate your models and datasets as you iterate on their versions.">development</Tooltip>
  and <Tooltip tip="Monitor a model in production, measure its health, check for drifts and set up alerts.">monitoring</Tooltip>.

## Why it matters

* LLMs are often prompted to generate a structured output, JSON being the most common format.
* If the LLM doesn't generate a valid JSON, it can break the downstream applications that rely on it.

## Test configuration examples

If you are writing a `tests.json`, here are a few valid configurations for the character length test:

<CodeGroup>
  ```json Development theme={null}
  [
    {
      "name": "Outputs have valid JSON",
      "description": "Asserts that the output column for all rows contains valid JSON",
      "type": "integrity",
      "subtype": "isJson",
      "thresholds": [
        {
          "insightName": "isJson",
          "insightParameters": [
            { "name": "column_name", "value": "output" } // Selects the column `output`
          ],
          "measurement": "isJsonRowPercentage",
          "operator": ">=",
          "value": 1.0
        }
      ],
      "subpopulationFilters": null,
      "mode": "development",
      "usesValidationDataset": true, // Apply test to the validation set
      "usesTrainingDataset": false,
      "usesMlModel": false,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689" // Some unique id
    }
  ]
  ```

  ```json Monitoring theme={null}
  [
    {
      "name": "Outputs have valid JSON",
      "description": "Asserts that the output column for all rows contains valid JSON",
      "type": "integrity",
      "subtype": "isJson",
      "thresholds": [
        {
          "insightName": "isJson",
          "insightParameters": [
            { "name": "column_name", "value": "output" } // Selects the column `output`
          ],
          "measurement": "isJsonRowPercentage",
          "operator": ">=",
          "value": 1.0
        }
      ],
      "subpopulationFilters": null,
      "mode": "monitoring",
      "usesProductionData": true,
      "evaluationWindow": 3600, // 1 hour
      "delayWindow": 0,
      "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689" // Some unique id
    }
  ]
  ```
</CodeGroup>

## Related

* JSON tests using [Great expectations](/tests/integrity/great-expectations), such as
  `expect_column_values_to_be_json_parseable`, `expect_column_values_to_match_json_schema`,
  and `expect_column_values_to_be_valid_json`.
