Skip to main content

JSON Schema and JSON Paths

JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It's a IETF (Internet and Engineering Task Force) public standard and is similar to a XML DTD but suited for JSON payloads.

We rely on JSON Schema heavily internally, from configuration validation to generating OpenAPI Spec to writing documentation. By using Ory Kratos, you will be exposed to JSON Schema as it's used for defining Identity Schemas and other things.

To learn more about JSON Schema, head over to json-schema.org/learn/.

Ory Kratos is using JSON Schema Draft7.

JSON Path Syntax

In some cases you can define a JSON Path. We use tidwall/gjson for this. A GJSON Path is a text string syntax that describes a search pattern for quickly retrieving values from a JSON payload.

There are two types of JSON Paths: