JSON Schema Checker and Schema Inference avatar

JSON Schema Checker and Schema Inference

Pricing

from $5.00 / 1,000 successful validation or inferences

Go to Apify Store
JSON Schema Checker and Schema Inference

JSON Schema Checker and Schema Inference

Validate a JSON document against a JSON Schema and list each failing path with its message, or infer a draft 2020-12 schema from JSON samples. Unsupported keywords are reported, not enforced. Makes no outside requests in its own code.

Pricing

from $5.00 / 1,000 successful validation or inferences

Rating

0.0

(0)

Developer

Brightwater Tools

Brightwater Tools

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

12 days ago

Last modified

Categories

Security

Limited permissions

Share

Check one JSON document against a JSON Schema and get every failing path with its message, or infer a JSON Schema (draft 2020-12) from one document or several samples. Paste your JSON, pick a mode, get the result. Each run does one mode.

$0.005 per successful run (UNCONFIRMED against the live Store). Failed runs are not charged.

What you can do with it

  • Check an API payload or config file against the schema your team agreed on, and see every field that breaks it, with its JSON Pointer path such as /items/2/sku.
  • Start a schema from examples. Paste a few sample records and get a draft 2020-12 schema with the types, the properties, and the properties that appear in every sample as required.
  • Use it as a step in your Apify integrations, Make, Zapier or n8n workflows, or call it from the Apify API.

How to use it

  1. Choose a mode: validate to check data against a schema, or infer to build a schema from data.
  2. Fill in the fields for that mode (see below).
  3. Click Start. The result appears in the Output tab and the dataset.

Mode: validate

FieldWhat to enter
dataThe JSON document to check (required)
schemaThe JSON Schema to check it against
max_input_bytesOptional size limit for schema and for data, each checked separately (default 1,000,000; up to 5,000,000)

Example input:

{
"mode": "validate",
"schema": "{\"type\": \"object\", \"required\": [\"part\", \"qty\"], \"properties\": {\"part\": {\"type\": \"string\"}, \"qty\": {\"type\": \"integer\", \"minimum\": 1}}}",
"data": "{\"part\": \"Bolt M6\", \"qty\": 0}"
}

Output (one dataset item):

{
"mode": "validate",
"valid": false,
"error_count": 1,
"errors": [
{ "path": "/qty", "message": "must be at least 1, found 0", "keyword": "minimum" }
],
"unsupported_keywords": [],
"sample_count": null,
"schema": null
}

Each error has a path (a JSON Pointer; an empty string means the whole document), a message and the keyword that failed. Every error is listed, not only the first.

Mode: infer

FieldWhat to enter
dataOne JSON document, or a JSON array of samples (required). Any value in the schema field is ignored.
max_input_bytesOptional size limit for the data (same rules as above)

In infer mode a top-level array is read as a list of samples, one per item. A single object or value is read as one document. To infer the schema of an array value itself, wrap it in another array. An empty array is refused.

Example input:

{
"mode": "infer",
"data": "[{\"part\": \"Bolt M6\", \"qty\": 4}, {\"part\": \"Nut M6\"}]"
}

Output (one dataset item):

{
"mode": "infer",
"valid": null,
"error_count": 0,
"errors": [],
"unsupported_keywords": [],
"sample_count": 2,
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"part": { "type": "string" },
"qty": { "type": "integer" }
},
"required": ["part"]
}
}

How the schema is built:

  • A key that appears in every object sample is required. A key missing from some samples is optional.
  • Numbers written without a decimal point give integer. A mix of whole and decimal numbers gives number.
  • Mixed kinds give a list of types, for example ["null", "string"] when a value is sometimes null.
  • Items of all arrays are merged into one items schema.
  • The inferred schema does not include enum, format, length limits or ranges.

Keywords the validator enforces

Validation covers a subset of JSON Schema, not a full validator for any draft. In validate mode these 24 keywords are enforced. Keywords next to $ref are applied too.

GroupKeywords
Types and fixed valuestype, enum, const
StringsminLength, maxLength, pattern
Numbersminimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf
Objectsrequired, properties, additionalProperties
Arraysitems, prefixItems, minItems, maxItems, uniqueItems
Combining schemasallOf, anyOf, oneOf, not
References$ref (local only: it must point into $defs or definitions)

Notes on the rules:

  • pattern uses Python's regular expression syntax and matches anywhere in the string. A pattern written for another validator may behave slightly differently.
  • minLength and maxLength count Unicode code points.
  • multipleOf compares the decimal values as written, so 0.3 is a multiple of 0.1.
  • integer accepts 2.0. true is not a number, and 1 does not equal true in const, enum or uniqueItems.

Keywords that are reported, not enforced

Any other keyword in the schema is not enforced. It is listed in unsupported_keywords with its schema path, so you can see what was skipped. The result is still based only on the supported keywords. Examples: format, contains, minProperties, maxProperties, patternProperties, propertyNames, if, then, else, dependentRequired, dependentSchemas, unevaluatedProperties and unevaluatedItems. Keywords nested inside an unsupported keyword are not read and are not listed.

Annotation keywords ($schema, $id, $comment, title, description, default, examples) are ignored and not listed.

A schema is refused with a message, and the run is not charged, when:

  • a supported keyword has the wrong shape (for example "required": "a" or "minimum": "1"),
  • a $ref points outside $defs or definitions, or to a target that does not exist,
  • items is given as an array of schemas (the draft-07 tuple form). Use prefixItems for that.

The draft named in the schema's $schema is not used to choose the rules in validate mode. The draft 2020-12 name applies only to the schema that infer mode writes.

Pricing

  • $0.005 per successful run, in either mode (UNCONFIRMED against the live Store).
  • Failed runs are not charged: bad input, a refused schema, or data too large.

Good to know

  • Size limit: the schema and the data are each limited to 1 MB by default (max_input_bytes, up to 5 MB).
  • Only JSON is accepted. NaN, Infinity and numbers too large for a standard floating-point value are refused.
  • Nesting depth: Nesting deeper than 200 levels is rejected with a clear error.

FAQ

Does it send my data anywhere? No. The actor's own code makes no outside requests. Results are saved to your run's dataset on Apify, as with any Apify actor.

Which schema draft does validation follow? None is selected. The same keyword set applies whatever $schema the schema names. Keywords outside the set are listed as unsupported.

Can I call it from code? Yes, through the Apify API or the Apify client for JavaScript or Python, like any Apify actor.

I found a bug or need a keyword. Open an issue on this actor's Issues tab.

AI use

This actor was written with the help of AI coding tools. The rules above describe exactly what the validation and inference do.


Made by Brightwater Tools.