> For the complete documentation index, see [llms.txt](https://www.csvpath.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.csvpath.org/topics/how-tos/validating-json/validating-json-documents.md).

# Validating JSON Documents

Using JSON Schema in CsvPath Framework

<figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2F61ipsDeDtGPJRlbSkq9y%2Fjson.png?alt=media&amp;token=0eacef10-ad48-4d21-91c3-5f0e5cb9b8e5" alt="" width="188"><figcaption></figcaption></figure>

JSON documents are everywhere, from FHIR to GeoJSON to Sellers.json. When you need to validate JSON documents you need [JSON Schema](https://json-schema.org/).&#x20;

{% hint style="info" %}
*On the other hand, if you have relatively flat JSONL you may want to stick with CsvPath Validation Language — now you have options!*
{% endhint %}

Using JSON Schema in CsvPath Framework is easy. The steps are:

* Create a JSON Schema
* Create a 1-line CsvPath statement to run it
* Load your CsvPath statement and JSON Schema into a validation group
* Register your file&#x20;
* Do your run

Voila, you get the same validation outputs as you would from any CsvPath Framework validation:

* data.json&#x20;
* errors.json
* vars.json
* meta.json
* manifest.json
* printouts.txt (or any individual reports you create)

### A Simple Example

First, the CsvPath Language driver. **Only lines 4, 5, and 6 are actually required**.&#x20;

Lines 1-3 configure a specific set of actions (or non-actions) to take when errors are found in the data. Here we're going to fail the run on error, print the error message, and suppress exceptions so the run completes without interruption, even if there is an error.

<div data-with-frame="true"><figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FDGt0IbkHgctOCEa9PXyj%2F1.png?alt=media&amp;token=2731609a-6257-4a12-ac85-039c2b5d427a" alt=""><figcaption></figcaption></figure></div>

Next the Python that makes the magic happen.&#x20;

You can do this in [FlightPath Data](https://www.flightpathdata.com/) without any code. Before you try that, check that your version supports JSON Schema validation.

<div data-with-frame="true"><figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FXekew5Rlg54A0XjIR19F%2F2.png?alt=media&amp;token=ffed4e2d-cf80-4391-a045-df1044f7a4e4" alt=""><figcaption></figcaption></figure></div>

Add a simple JSON Schema to verify our file of import/export automobile data meets expectations.

<div data-with-frame="true"><figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FF9KFjynLtaD2KukBBy8H%2FScreenshot%202026-09-15%20at%206.18.11%E2%80%AFPM.png?alt=media&amp;token=41c4c6a5-7b39-4eea-82a1-ac3bbf7d3e17" alt=""><figcaption></figcaption></figure></div>

The JSON Schema is stored in the named-paths group, along with the csvpath driver statement, configuration files, and the README.md.

And here is the result of the run.&#x20;

<div data-with-frame="true"><figure><img src="https://2402701329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6wzqgDHj9mZbFxabiEbc%2Fuploads%2FQe1gJB9cs1XMYvvMmmeH%2FScreenshot%202026-09-15%20at%206.13.01%E2%80%AFPM.png?alt=media&amp;token=eba51b13-0088-4b5a-a11e-dc73f6d60880" alt=""><figcaption></figcaption></figure></div>

This view is the key point: all your validation assets from JSON Schema are exactly the same. You get the same rich metadata, the same OpenLineage and OpenTelemetry events, and the same reporting capabilities for JSON Schema as you do for CsvPath Validation Language.&#x20;

Your edge data governance of Excel and JSON and JSONL/NDJSON and CSV and XML all happen in exactly the same way. That's control you can use.
