For the complete documentation index, see llms.txt. This page is also available as Markdown.

Validating JSON Documents

Using JSON Schema in CsvPath Framework

JSON documents are everywhere, from FHIR to GeoJSON to Sellers.json. When you need to validate JSON documents you need JSON Schema.

On the other hand, if you have relatively flat JSONL you may want to stick with CsvPath Validation Language — now you have options!

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

  • Do your run

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

  • data.json

  • 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.

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.

Next the Python that makes the magic happen.

You can do this in FlightPath Data without any code. Before you try that, check that your version supports JSON Schema validation.

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

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.

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.

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.

Last updated