跳转到主要内容
CuteJSON
↑↓ 导航 Enter 选择 Esc 关闭

JSON to SQL Converter

Turn a JSON document into a CREATE TABLE statement and the INSERT statements to load it, for the dialect you actually run.

返回所有工具

键盘快捷键

这些快捷键在页面上对应操作存在时有效。

打开命令面板
Ctrl/Cmd + K
运行主要操作
Ctrl/Cmd + Enter
格式化
Ctrl/Cmd + Shift + F
压缩
Ctrl/Cmd + Shift + M
复制输出
Ctrl/Cmd + Shift + C
打开文件
Ctrl/Cmd + Shift + O
下载输出
Ctrl/Cmd + S
关闭此对话框
Esc
打开此对话框
F1 / ?

本地数据

以下所有内容仅存储在此浏览器、此设备上。

未保存的草稿
记住选项的工具

最近打开的文件

    此设备上尚未打开任何文件。

    通过链接分享

    内容被打包在链接 # 号之后的部分。

    分享此页面上的第一个输入。

    暂无可分享的内容。

    输入

    从 URL 加载

    直接从浏览器获取 URL。

    输出

    结果将显示在此处。

    完全在您的浏览器中运行。

    关于此工具

    Four SQL dialects, because CREATE TABLE and identifier quoting genuinely differ enough between them that picking one would be wrong for the other three. The document has to be an array of objects, or a single object as a one row table, the same shape the CSV converter accepts. Every column type is inferred by looking at every occurrence of that column across every record, not just the first one: a column falls back to a plain text column the moment two records disagree on its kind, a column that is always null gives nothing to infer from, and a nested object or array becomes either the dialect native JSON column type or a plain text column, your choice, since SQLite and SQL Server have no native JSON column type of their own either way. A column of pure integers gets its digit count checked against a safe range for a normal integer column; past that it gets a big or arbitrary precision decimal type instead, because a twenty digit id silently declared as a normal integer would silently overflow the moment the statement actually ran. Every identifier is quoted in the target dialect own style and every string is escaped for that dialect too, so the output is meant to run as written rather than be corrected by hand first. This produces SQL, not JSON, and no dialect reads SQL back into JSON, so this is one direction only, the same as the TypeScript and schema generators on this site.

    使用方法

    1. Paste your JSON on the left, or load the sample.
    2. Choose a dialect, a table name, and any options, then press Convert.
    3. Copy the result or download it as a file.