SQL ↔ JSON Schema 转换器
免费在线 SQL CREATE TABLE 与 JSON Schema 双向转换工具:从建表 DDL 自动生成 JSON Schema Draft-07,含字段类型映射 / 必填项 / 默认值 / 注释;也支持 JSON Schema 反向生成 CREATE TABLE。所有处理在浏览器本地完成
SQL (CREATE TABLE)
JSON Schema output
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "#/definitions/users",
"title": "users",
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 0
},
"email": {
"type": "string",
"maxLength": 255
},
"name": {
"type": "string",
"maxLength": 100,
"default": ""
},
"age": {
"type": "integer"
},
"status": {
"type": "integer",
"minimum": -128,
"maximum": 127,
"default": 1,
"description": "0:disabled 1:active"
},
"bio": {
"type": "string"
},
"avatar_url": {
"type": "string",
"maxLength": 500
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"email"
],
"x-primary-key": [
"id"
]
}User Guide
✨ Features
• Convert CREATE TABLE → JSON Schema Draft-07 with type mapping, required, default, comments, primary keys • Smart type mapping: VARCHAR(N) → string + maxLength; INT UNSIGNED → integer + minimum=0; TIMESTAMP → string + format:date-time; JSON → object • Reverse: JSON Schema → CREATE TABLE — picks the right SQL type from JSON Schema type / format / maxLength • Multi-table SQL automatically grouped under JSON Schema definitions • Live conversion + error feedback; all processing local
📖 How to Use
Step 1
Pick direction: SQL → JSON Schema or JSON Schema → SQL
Step 2
Paste DDL or schema on the left
Step 3
Right pane shows converted output with syntax highlighting
Step 4
Use 'Swap' to send output back to input — useful for round-trip verification
Like it? Rate it!