rocket

JSON Schema Inferer

A live JSON Schema / TypeScript type inferer: paste a sample JSON payload and get a draft-07 JSON Schema or an equivalent TypeScript type — with integer/number distinction, string format detection (date-time/date/email/uuid), nested objects, array item merging and optional-field detection across array items.

npx shadcn@latest add https://rocket.gozturk.dev/r/json-schema-inferer.json
draft-07 schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "active": {
      "type": "boolean"
    },
    "score": {
      "type": "number"
    },
    "age": {
      "type": "integer"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "roles": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "profile": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string"
        },
        "verified": {
          "type": "boolean"
        }
      },
      "required": [
        "city",
        "verified"
      ]
    },
    "orders": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "total": {
            "type": "number"
          },
          "coupon": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "total"
        ]
      }
    },
    "lastSeen": {
      "type": "null"
    }
  },
  "required": [
    "id",
    "active",
    "score",
    "age",
    "email",
    "createdAt",
    "roles",
    "profile",
    "orders",
    "lastSeen"
  ]
}

inferred from a single sample — optional fields are only detected across array items