首页Home › 开发工具Developer Tools

🗄️ SQL 转 JSON(INSERT 语句转 JSON)SQL to JSON Converter

把 SQL INSERT 语句转换为 JSON 对象数组:识别列名、多行 VALUES、多条语句和多张表,支持 MySQL 反引号、字符串转义、NULL、TRUE/FALSE 和数字。Convert SQL INSERT statements into a JSON array of objects. Column lists, multi-row VALUES, several statements and several tables are handled, including MySQL backticks, escaped strings, NULL, TRUE/FALSE and numbers.

使用说明与常见问题How-to & FAQ

「SQL 转 JSON(INSERT 语句转 JSON)」是什么?What is the SQL to JSON Converter tool?

把 SQL INSERT 语句转换为 JSON 对象数组:识别列名、多行 VALUES、多条语句和多张表,支持 MySQL 反引号、字符串转义、NULL、TRUE/FALSE 和数字。Convert SQL INSERT statements into a JSON array of objects. Column lists, multi-row VALUES, several statements and several tables are handled, including MySQL backticks, escaped strings, NULL, TRUE/FALSE and numbers.

如何使用「SQL 转 JSON(INSERT 语句转 JSON)」?How do I use the SQL to JSON Converter tool?

在「SQL 转 JSON(INSERT 语句转 JSON)」中,把内容粘贴或输入到上方输入框,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「INSERT INTO t (a) VALUES ();」,得到「⚠ 表 t 的 VALUES 中有一对空括号 ()」。In the SQL to JSON Converter: Paste or type into the input box; the result appears below instantly — click "Copy result" to copy it. Example: "INSERT INTO t (a) VALUES ();" → "⚠ 表 t 的 VALUES 中有一对空括号 ()".

支持哪些 SQL 写法?Which SQL syntax is supported?

支持 INSERT INTO 表 (列…) VALUES (…), (…);INSERT IGNORE;省略列名(自动命名为 col1、col2…);带库名的表名 db.table(按完整名称分组,db1.users 和 db2.users 分开);反引号、双引号和方括号标识符;以及 -- 、# 和 /* */ 注释。CREATE TABLE、UPDATE 等语句会被忽略。INSERT INTO table (cols…) VALUES (…), (…); INSERT IGNORE; no column list (named col1, col2 …); schema-qualified names like db.table (grouped under the full name, so db1.users and db2.users stay separate); backtick, double-quote and bracket identifiers; and --, # and /* */ comments. CREATE TABLE, UPDATE and other statements are ignored.

值的类型怎么判断?How are value types decided?

带引号的是字符串;数字转为 JSON 数字;NULL、TRUE、FALSE 转为 null、true、false。超过 JavaScript 安全整数范围(2^53)的整数、超过 15 位有效数字的小数和超出范围的数字(如 1e400)都会按原文保留为字符串,避免丢失,并在结果下方提示;函数调用如 NOW() 原样作为字符串。注释会被跳过,注释掉的 INSERT 不会被转换。Quoted values become strings; numbers become JSON numbers; NULL, TRUE and FALSE become null, true and false. Integers beyond JavaScript's safe range (2^53), decimals with more than 15 significant digits and numbers too large for JavaScript (1e400) stay as strings so nothing is lost, with a notice; function calls such as NOW() are kept as text. Comments are skipped, so a commented-out INSERT is ignored.

单引号如何转义?How are quotes escaped?

标准 SQL 用两个单引号 '' 表示一个单引号,始终支持;MySQL 的反斜杠转义(\' \n)默认开启,如果你的数据中反斜杠是普通字符(如 Windows 路径,来自 PostgreSQL),请取消勾选。Standard SQL doubles the quote ('') and that always works. MySQL backslash escapes (\' \n) are on by default; untick them if backslashes are literal in your data, for example Windows paths from PostgreSQL.

代码或数据会被上传吗?Is my code or data uploaded?

不会。「SQL 转 JSON(INSERT 语句转 JSON)」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The SQL to JSON Converter runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.

「SQL 转 JSON(INSERT 语句转 JSON)」免费吗?需要注册吗?Is the SQL to JSON Converter free? Do I need an account?

「SQL 转 JSON(INSERT 语句转 JSON)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The SQL to JSON Converter is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

📗 CSV 转 Excel(XLSX)CSV to Excel Converter📊 XLS 转换器(XLS ⇄ XLSX/CSV/ODS)XLS Converter🧾 JSON 格式化校验JSON Formatter & Validator🧪 正则表达式测试Regex Tester⏰ Cron 表达式解析Cron Expression Explainer🔀 YAML JSON 互转YAML to JSON Converter📊 CSV JSON 互转CSV to JSON ConverterⓂ️ Markdown 在线预览Markdown Live Preview🗄️ SQL 格式化/压缩SQL Formatter & Minifier🧵 字符串转义/反转义String Escape / Unescape📰 XML 格式化XML Formatter & Validator🔁 XML 转 JSONXML to JSON Converter

← 全部工具All tools