82trust / 100

Json Schema Infer

by JSON Schema infer in Documents & files

x402 APIPassing, checked 2 h ago

Infer a draft-07 JSON Schema from sample JSON document(s). Send one sample as json, or several as samples. Heuristic merge rules: required = keys present in every sample, conflicting types become a type union, integer widens to number, and string formats (date-time, date, email, uri, uuid) are detected from values. Complements json-validate.

POST https://agent402.tools/api/json-schema-infer

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
193 ms typical, 193 ms slowest 5%
Last check
2 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/json-schema-infer" \
  -H "content-type: application/json" \
  -d '{"json":{"active":true,"age":36,"joined":"1843-10-18","name":"Ada","tags":["pioneer"]}}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fjson-schema-infer
const res = await pay("https://agent402.tools/api/json-schema-infer", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"json":{"active":true,"age":36,"joined":"1843-10-18","name":"Ada","tags":["pioneer"]}}),
});
console.log(await res.json());

Example input

{
  "json": {
    "active": true,
    "age": 36,
    "joined": "1843-10-18",
    "name": "Ada",
    "tags": [
      "pioneer"
    ]
  }
}

Example output

{
  "samples": 1,
  "schema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {
      "age": {
        "type": "integer"
      },
      "name": {
        "type": "string"
      }
    },
    "required": [
      "name",
      "age"
    ],
    "type": "object"
  }
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402329 ms$0.001
7 h agoPassed402193 ms$0.001