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

# JSON Schema Metrics

JSON Schema Metrics allow model outputs to be validated against a predefined data structure.

These metrics are useful when not only the content of the response matters, but also its format.

Once saved, a JSON Schema Metric becomes available for use in any Test Suite.

## Creating a JSON Schema Metric

To create a new metric:

<Steps>
  <Step title="Open Metrics">
    Open the **Metrics** section.
  </Step>

  <Step title="Create a metric">
    Click **New Metric**.
  </Step>

  <Step title="Select JSON Schema Match">
    Select **JSON Schema Match** in the **Evaluation Type** field.
  </Step>
</Steps>

After selecting the evaluation type, JSON Schema configuration becomes available.

## Basic Configuration

Each metric includes the following settings:

* Label
* Name
* Evaluation Type

These settings are used to identify the metric throughout the platform.

## JSON Schema Editor

JSON Schema Metrics support two editing modes:

<Tabs>
  <Tab title="Form">
    Build the schema visually using fields, types, descriptions, required flags, and enums.
  </Tab>

  <Tab title="Raw">
    Edit the underlying JSON Schema directly.
  </Tab>
</Tabs>

The mode selector is located in the upper-right corner of the editor.

Both modes work with the same schema.

<img src="https://mintcdn.com/intelleap/h4CIG-p7Mjr0kT4g/images/screens/Metrics/6.png?fit=max&auto=format&n=h4CIG-p7Mjr0kT4g&q=85&s=c0a7068c1f9a959bd6f175195139c11c" alt="Form Mode" width="3280" height="2202" data-path="images/screens/Metrics/6.png" />

## Form Mode

Form Mode provides a visual schema builder.

Each schema field can be configured using the following properties:

* Type
* Name
* Description
* Required
* Enums

Supported field types include:

* String
* Number
* Boolean
* Object
* Array

New fields can be added directly through the builder.

This allows complex schemas to be created without manually writing JSON Schema.

## Nested Structures

Object and Array types support nested elements.

This makes it possible to define complex data structures with multiple levels of hierarchy.

For example:

* An object can contain other objects.
* An array can contain objects.
* Objects inside arrays can contain their own nested fields.

This flexibility allows JSON Schema Metrics to validate sophisticated structured outputs.

## Raw Mode

Raw Mode displays the schema as JSON Schema.

This mode provides direct access to the underlying schema definition.

<img src="https://mintcdn.com/intelleap/h4CIG-p7Mjr0kT4g/images/screens/Metrics/7.png?fit=max&auto=format&n=h4CIG-p7Mjr0kT4g&q=85&s=8e7ca54bd3660d0a008364df8a535099" alt="Raw Mode" width="3280" height="2202" data-path="images/screens/Metrics/7.png" />

## Synchronization Between Modes

Form Mode and Raw Mode operate on the same schema.

Changes made in Form Mode are automatically reflected in Raw Mode as JSON Schema.

Changes made in Raw Mode are also reflected in Form Mode.

The editor provides full two-way synchronization between both representations.

If the schema entered in Raw Mode is invalid, the changes are not applied to Form Mode.

<Warning>
  Invalid Raw Mode edits are not applied to Form Mode. The editor preserves the last valid schema version.
</Warning>

In that case, the editor preserves the last valid schema version and continues using it for visual editing.

This allows users to switch safely between editing modes without risking schema corruption.

## Using JSON Schema Metrics

After saving, the metric becomes available in the Testing section.

To attach a metric to a Test Suite, use:

```text theme={null}
Manage → Metrics
```

During test execution, the metric validates model outputs against the configured JSON Schema.

## When to Use JSON Schema Metrics

JSON Schema Metrics are particularly useful when responses must follow a strict structure.

Common use cases include:

* Structured output validation
* Data extraction workflows
* Classification tasks
* JSON responses for APIs
* Forms and questionnaires
* Any workflow where output format consistency is important
