JSON Schema ジェネレーター

例の JSON データから JSON Schema を生成します

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 を貼り付けると、このツールはオブジェクト、配列、数値、真偽値、null、そして一般的な文字列フォーマットに対する初期 schema を推定します。結果はそのままコピー、ダウンロード、調整ができます。

たとえば、次のサンプルデータがあるとします。

サンプル入力

{
  "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」をオフにしてください。
  • より厳しい schema を初期状態で作りたい場合は「Allow additional properties」をオフにしてください。
  • email、URI、UUID、date-time を推定するため、文字列フォーマット検出はオンのままにしておくと便利です。