İçeriğe geç
uxTools
Veri & Formatlar

JSON Schema Üreticisi

Bir JSON örneği yapıştır, temiz bir şema (draft-07 veya draft-2020-12) ve eşleşen TypeScript tiplerini al — format tespiti, zorunlu alan çıkarımı ve enum ipuçlarıyla.

Kaynak boyutu

536 B

Şema boyutu

2.1 KB

Çıkarılan alan

24

JSON örneği

Gerçek bir JSON belgesi yapıştır — örnek ne kadar zengin, üretilen şema o kadar isabetli olur. Dosyalar sadece tarayıcında okunur.

Üretici seçenekleri

Sürümü, zorunlu alanları ve format tespitini ayarla.

Sürüm

Zorunlu alanlar

Ek özellikler

Null davranışı

String formatlarını yakala

Tarih, e-posta, URI, UUID ve IP gibi formatları otomatik etiketle.

Dizilerde enum yakala

Aynı string değer örnekler arasında tekrar ediyorsa enum olarak işle.

$id ve title ekle

Şema başka yerlerden referans alınacaksa kullanışlıdır.

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "active": {
      "type": "boolean"
    },
    "score": {
      "type": "number"
    },
    "rank": {
      "type": "integer"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "address": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string"
        },
        "zip": {
          "type": "string"
        },
        "geo": {
          "type": "object",
          "properties": {
            "lat": {
              "type": "number"
            },
            "lng": {
              "type": "number"
            }
          },
          "required": [
            "lat",
            "lng"
          ],
          "additionalProperties": true
        }
      },
      "required": [
        "city",
        "zip",
        "geo"
      ],
      "additionalProperties": true
    },
    "orders": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "total": {
            "type": [
              "number",
              "integer"
            ]
          },
          "currency": {
            "type": "string"
          },
          "shippedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "total",
          "currency",
          "shippedAt"
        ],
        "additionalProperties": true
      }
    },
    "website": {
      "type": "string",
      "format": "uri"
    }
  },
  "required": [
    "id",
    "createdAt",
    "name",
    "email",
    "active",
    "score",
    "rank",
    "tags",
    "address",
    "orders",
    "website"
  ],
  "additionalProperties": true,
  "$schema": "http://json-schema.org/draft-07/schema#"
}