integer
string
string
integer
boolean
array
输出格式:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "User",
"description": "用户信息模型",
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "用户唯一ID",
"examples": [
1
]
},
"name": {
"type": "string",
"description": "用户名称",
"examples": [
"Alice"
]
},
"email": {
"type": "string",
"description": "邮箱地址",
"examples": [
"alice@example.com"
]
},
"age": {
"type": "integer",
"description": "年龄",
"examples": [
25
]
},
"active": {
"type": "boolean",
"description": "是否激活",
"examples": [
true
]
},
"tags": {
"type": "array",
"description": "标签列表",
"examples": [
[
"admin",
"user"
]
],
"items": {
"type": "string"
}
}
},
"required": [
"id",
"name",
"email"
]
}工具说明
在线 JSON Schema 生成工具,粘贴 JSON 数据自动推断并生成对应的 JSON Schema 定义,支持 Draft-07 格式,适合 API 文档编写。
json schemajsonschemavalidationapiopenapi