Validate JSON
Check JSON: that it is well written, that the paths you need are there and, if you give one, that it follows a JSON Schema.
Command in the JSON toolkit · id ooa.json/validate · 9 inputs, 3 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| JSON | Any | No | JSON text, Dictionary or List to check (or use a file or a session). | |
| Required keys | List | No | Paths that must exist, e.g. ["id", "customer.email"]. | |
| Schema | Any | No | JSON Schema (draft-07 to 2020-12) as a Dictionary or JSON text; $ref may point inside it, to another file (with schema_path or an $id) or to a URL. | |
| Schema path | File | No | JSON Schema file; used when 'schema' is empty. References such as address.json#/$defs/x are read from its folder. | |
| Check formats | Boolean | No | true | Check the format keyword: date-time, date, time, duration, email, hostname, ipv4, ipv6, uri, uuid, regex and json-pointer. |
| Load remote refs | Boolean | No | true | Follow $ref to other schema files and http(s) URLs (30 s timeout, 5 MB limit); false allows references inside the schema only. |
| Path | File | No | JSON file to check (instead of json). | |
| Required types | Dictionary | No | Paths that must exist with a type: String, Number, Boolean, List, Dictionary or Null. | |
| Session | String | No | Check the document of this JSON session (Start session). |
Outputs
| Output | Type | What it is |
|---|---|---|
| valid | Boolean | True when the JSON parses and every required path exists. |
| errors | List | Problems found, each with the path where it was found. |
| level | String | What was checked: syntax (the text did not parse), structure or schema. |