JSON Schema Generator - Infer Draft-07 from JSON or URL avatar

JSON Schema Generator - Infer Draft-07 from JSON or URL

Pricing

from $1.60 / 1,000 inferred schemas

Go to Apify Store
JSON Schema Generator - Infer Draft-07 from JSON or URL

JSON Schema Generator - Infer Draft-07 from JSON or URL

Generates a draft-07 JSON Schema from a JSON sample or an API URL. Returns the schema with nested types, required fields, enums and formats (email, uuid, uri, date-time), plus stats. HTTP errors and invalid JSON are free. For API integrators, LLM app developers and QA engineers.

Pricing

from $1.60 / 1,000 inferred schemas

Rating

0.0

(0)

Developer

Broke to Built

Broke to Built

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

14 days ago

Last modified

Features

Limited permissions

Share

JSON Schema Inferer — Draft-07 Schema from Any JSON or API URL

Point it at a JSON URL or paste raw JSON — get back a clean draft-07 JSON Schema with types, required fields, string formats (email, date-time, uuid, uri), and small enums detected automatically. Up to 50 samples per run, online, by API, or as an agent tool via Apify MCP.

Writing schemas by hand for an API response you don't control is busywork; validating LLM output needs a schema you often don't have yet. This actor infers one from real data: objects get properties + required lists, arrays get merged item schemas across every element (union types where items disagree, required = keys present in all items), repeated small value sets become enums.

What you get

  • schema — a complete draft-07 JSON Schema for the sample
  • stats — property count, required-field count, formats and enums detected
  • rootType and source (URL + final URL + HTTP status, or raw-json marker)
  • Fail-soft: a URL that returns non-JSON never fails the run — it returns {ok: false, error} and is never charged.

Input

{ "url": "https://api.example.com/users/1" }

Or raw JSON: { "json": "{\"id\": 1, \"email\": \"ada@example.com\"}" }. Bulk via urls array. Toggles: detectFormats, detectRequired.

Output (real run, trimmed)

For https://jsonplaceholder.typicode.com/users/1:

{
"ok": true,
"rootType": "object",
"schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": { "type": "integer" },
"email": { "type": "string", "format": "email" },
"address": { "type": "object", "properties": { "...": "..." } }
},
"required": ["id", "name", "username", "email", "..."]
},
"stats": { "properties": 18, "requiredFields": 18, "formatsDetected": 1, "enumsDetected": 0 }
}

Example

A real run on 2026-10-31 with the input this page's form is prefilled with:

{
"url": "https://jsonplaceholder.typicode.com/users/1",
"json": "{\n \"id\": 1,\n \"email\": \"ada@example.com\",\n \"createdAt\": \"2024-01-15T09:30:00Z\",\n \"role\": \"admin\",\n \"tags\": [\"alpha\", \"beta\"]\n}"
}

It finished in 2 seconds and returned 1 result. It was charged for 1 schema-inferred event ($0.002 on the Free plan). The first result (long text and lists cut for display):

{
"source": {
"type": "json"
},
"ok": true,
"rootType": "object",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"email": {
"type": "string",
"format": "email"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"role": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"id",
"email",
"createdAt",
"… 2 more"
],
"$schema": "http://json-schema.org/draft-07/schema#"
},
"stats": {
"properties": 5,
"requiredFields": 5,
"formatsDetected": 2,
"enumsDetected": 0
}
}

Pricing

$0.002 per schema inferred. No start fee. Non-JSON responses and parse failures are never charged.

Measured against store incumbents (2026-08-07): gochujang/json-schema-generator charges $0.001 start + $0.01 per schema, perryay/json-schema-validator-generator $0.05 start + $0.025 per inference, perryay/json-studio $0.01 start + $0.005 per inference. One schema here costs $0.002 vs $0.011–$0.075 there.

Honest limits

  • Inference is sample-based: the schema describes the data you showed it. A field that happens to be absent from your sample won't appear; a field that is always present in a 3-item sample gets marked required even if it is optional in the wild. More samples = better schema.
  • Formats are detected by pattern (RFC-3339 date/date-time, email, uuid, uri) — a string that merely looks like an email is marked format: email.
  • Enums are only attached for arrays of ≤12 distinct scalar values with repeats — deliberate, to avoid freezing IDs into enums.
  • Draft-07 output; no $ref factoring (nested objects are inlined).

FAQ

Can I use the output to validate LLM responses? Yes — that is a primary use: infer once from a good sample, then validate every generation against it with ajv or any draft-07 validator.

How does it handle arrays with mixed item shapes? Item schemas are merged: shared keys keep their types (union if they disagree), required keeps only keys present in every item.

What about huge responses? The whole document is analyzed — stats tell you how big the schema got. For multi-megabyte payloads, prefer passing one representative record.

Does it fetch with authentication? No auth headers currently — public URLs only, or paste the JSON directly (which also works for anything private, since raw samples never leave the run).

Why did some rows come back ok: false? The URL returned non-JSON (HTML, error page) or unparseable text. Recorded with the HTTP status, never charged.

Use from code or AI agents

curl -s "https://api.apify.com/v2/acts/EliAI~json-schema-inferer/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-X POST -H 'Content-Type: application/json' \
-d '{"url": "https://api.example.com/endpoint.json"}'

Agents: connect Apify MCP and call the EliAI/json-schema-inferer tool.

  • Capability: infer a draft-07 JSON Schema from a URL's response or a raw JSON sample
  • Required input: url/urls or json
  • Returns: one record per sample; schema is the full JSON Schema, stats summarizes it
  • Bounded: max 50 samples per run; failures isolate per sample
  • Side effects: none

Who uses it

  • API integrators generating a draft-07 schema from a third-party response they do not control
  • LLM app developers creating a schema to validate model JSON output against
  • Data engineers documenting the shape of a JSON feed before loading it into a warehouse
  • QA engineers writing contract tests from a sample of real API responses
  • Technical writers producing field-level docs from an endpoint's JSON

Changelog

  • 2026-11-01: Page text only: an Example section from a real run. Code, output and price are unchanged.