مولد مخطط JSON

ينشئ مخطط JSON من بيانات JSON نموذجية

إدخال JSON
Paste example JSON or import a file to infer a starting schema.
المخطط المُولّد
Review the generated schema, then copy or download it for further refinement.
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "age": {
      "type": "integer"
    },
    "active": {
      "type": "boolean"
    },
    "website": {
      "type": "string",
      "format": "uri"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "address": {
      "type": "object",
      "properties": {
        "street": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "postalCode": {
          "type": "string"
        }
      },
      "required": [
        "street",
        "city",
        "postalCode"
      ]
    },
    "projects": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "name",
          "year"
        ]
      }
    },
    "lastSeen": {
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "type": "null"
    }
  },
  "required": [
    "id",
    "name",
    "email",
    "age",
    "active",
    "website",
    "tags",
    "address",
    "projects",
    "lastSeen",
    "metadata"
  ]
}
الخيارات

ما هو JSON Schema؟

JSON Schema هو معيار لوصف بنية بيانات JSON. يتيح لك التعبير عن أنواع الحقول، والبنى المتداخلة، والمفاتيح المطلوبة، والقيود المفيدة لعمليات التحقق.

ماذا يفعل هذا المولّد

ألصق JSON تجريبياً وسيستنتج هذا الأدوات schema أولياً للكائنات والمصفوفات والأرقام والقيم المنطقية وnull وصيغ السلاسل الشائعة. يمكن بعد ذلك نسخ النتيجة أو تنزيلها أو تعديلها.

مثال

على سبيل المثال، مع هذه البيانات التجريبية:

إدخال تجريبي

{
  "id": "bk-101",
  "title": "In-browser Tools",
  "price": 19.99,
  "tags": ["json", "schema"],
  "published": true
}

الـ schema الناتج

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": { "type": "string" },
    "title": { "type": "string" },
    "price": { "type": "number" },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    },
    "published": { "type": "boolean" }
  },
  "required": ["id", "title", "price", "tags", "published"]
}

نصائح

  • استخدم بيانات تجريبية ممثلة، خصوصاً داخل المصفوفات، حتى يسهل اكتشاف الحقول الاختيارية.
  • عطّل “Infer required properties” إذا كان الإدخال مجرد مثال جزئي.
  • عطّل “Allow additional properties” إذا كنت تريد schema أكثر صرامة بشكل افتراضي.
  • أبقِ كشف صيغ السلاسل مفعلاً لاستنتاج email وURI وUUID وdate-time.