JSON 转 SQL
UpBox优盒工具箱,免费在线 JSON 转 SQL 工具,把 JSON 数组转成 CREATE TABLE 与 INSERT 语句,自动汇总字段、推断列类型、转义引号,支持 MySQL 与 PostgreSQL。
无需注册 · 数据不上传No sign-up · nothing uploaded
源 JSONSource JSON
数据行0
字段数0
语句行数0
SQL 语句SQL statements
粘贴 JSON 数组后自动生成
字段缺失时输出 NULL;字符串中的单引号会自动转义为两个单引号
本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器
工具介绍
把接口返回的 JSON 数组粘进来,工具会汇总所有字段生成建表语句,字段缺失的行补 NULL,字符串中的引号自动转义。 Paste a JSON array from an API and the tool collects every field into a CREATE TABLE, filling missing values with NULL and escaping quotes.
数值自动区分 INT / BIGINT / DOUBLE,布尔按数据库方言输出 1/0 或 true/false,MySQL 用反引号、PostgreSQL 用双引号包裹标识符。 Numbers become INT, BIGINT or DOUBLE; booleans follow the dialect (1/0 or true/false); identifiers use backticks on MySQL and double quotes on PostgreSQL.
- 建表 + 插入CREATE + INSERT
- 类型推断Type inference
- 引号转义Quote escaping
- 双数据库方言Two dialects
- 本地处理Local processing
使用说明
- 粘贴 JSON 对象或对象数组。Paste a JSON object or array of objects.
- 填写表名、选择数据库。Set the table name and database.
- 按需关闭建表语句。Turn the CREATE statement off if not needed.
- 复制 SQL 或下载 .sql。Copy the SQL or download a .sql file.
常见问题
字段类型能改吗?Can I change column types?
生成后可直接编辑,例如把 VARCHAR(255) 改成 TEXT 或加索引。Edit the output freely — change VARCHAR(255) to TEXT or add indexes.
嵌套对象怎么处理?How are nested objects handled?
会序列化成 JSON 字符串写入单列,需要拆表请先扁平化数据。They are serialized as JSON strings in one column; flatten the data first if you need separate tables.
日期会转成时间类型吗?Are dates converted to date types?
不会,日期字符串仍按 VARCHAR / TEXT 输出。No, date strings stay VARCHAR or TEXT.
支持大批量吗?Does it handle large arrays?
纯文本生成,几千行仍可用,超大文件建议用脚本处理。It is plain text generation and handles thousands of rows; use a script for very large files.