JSON转Base64
JSON 与 Base64 互转,支持 UTF-8。
关于「JSON转Base64」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- 编码前会先把 JSON <b>压缩</b>去掉空白,能让结果短不少。
- 中文等非 ASCII 字符通过 <b>UTF-8</b> 正确编码,不会出现乱码。
- <b>URL 安全变体</b>把 <code>+ /</code> 换成 <code>- _</code> 并去掉结尾的 <code>=</code>,可直接放进 URL 或 JWT。
- 解码后若内容是合法 JSON 会自动格式化,否则原样输出纯文本。
- Base64 只是编码不是加密,<b>任何人都能还原</b>,不要用它保护敏感信息。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON转Base64、JSON 工具、base64、编码、在线工具、免费
如何使用「JSON转Base64」
- 打开工具:打开「JSON转Base64」页面,无需注册、无需安装任何软件。
- 准备输入:准备好要处理的内容或文件:文本可直接粘贴,文件可拖入页面(本工具属于「JSON 工具」)。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- Base64 能当作加密使用吗?
- 绝对不能。它是一种公开的可逆编码,目的只是让二进制数据能在文本通道里安全传输。任何人拿到编码结果都能瞬间还原出原文。
- 为什么编码后反而变长了?
- Base64 用 4 个字符表示 3 个字节,体积必然增加约 33%。它换来的是内容不含特殊字符,可以安全地嵌入 URL、JSON 或邮件正文。
- 什么时候需要 URL 安全变体?
- 标准 Base64 里的 <code>+</code> 和 <code>/</code> 在 URL 中有特殊含义,<code>=</code> 也容易被截断。放进查询参数、路径或 JWT 时,就要用 URL 安全变体。
- 中文会乱码吗?
- 不会。工具先用 UTF-8 把文本编成字节再做 Base64,解码时按相同规则还原,中文、emoji 都能完整往返。
JSON to Base64 (English)
Convert JSON to and from Base64 with UTF-8 support.
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- Before encoding, JSON is <b>minified</b> to drop whitespace, making the result much shorter.
- Non-ASCII chars like Chinese are correctly encoded via <b>UTF-8</b>, no mojibake.
- The <b>URL-safe variant</b> swaps <code>+ /</code> for <code>- _</code> and drops trailing <code>=</code>, ready for URLs or JWTs.
- After decoding, valid JSON is auto-formatted; otherwise it is output as plain text.
- Base64 is encoding, not encryption — <b>anyone can reverse it</b>; do not use it to protect sensitive data.
Free, no sign-up; everything runs locally in your browser and files are never uploaded.
Keywords: JSON to Base64, JSON Tools, base64, encode, online tool, free
How to use it
- Open the tool:Open the “JSON to Base64” page — no sign-up and nothing to install.
- Prepare the input:Prepare the content or file to process: paste text or drop a file onto the page (this tool belongs to “JSON Tools”).
- Provide the input:Paste your content into the input box or drop a file onto the page; you can also click “Sample” to try example data first.
- Adjust options and run:Adjust the options if needed, then click the process / convert / generate button.
- Get the result:Everything runs locally in your browser; copy or download the result — your files are never uploaded.
FAQ
- Can Base64 be used as encryption?
- Never. It is a public, reversible encoding meant only to let binary data travel safely in text channels. Anyone with the output can instantly recover the original.
- Why is it longer after encoding?
- Base64 uses 4 chars for 3 bytes, so size grows ~33%. In return the content has no special chars and can safely embed in URLs, JSON or email.
- When do I need the URL-safe variant?
- Standard Base64 <code>+</code> and <code>/</code> are special in URLs and <code>=</code> gets truncated. Use the URL-safe variant in query params, paths or JWTs.
- Will Chinese become garbled?
- No. The tool encodes text to bytes via UTF-8 before Base64, and reverses it on decode, so Chinese and emoji round-trip intact.
More tools in JSON Tools
- JSON Formatter/Minifier — Beautify, minify, validate and highlight JSON.
- Sort JSON Keys — Recursively sort object keys alphabetically to ease diffing.
- Flatten JSON — Flatten nested structures into a.b.c single-level keys.
- Unflatten JSON — Restore dotted-path objects into nested structures.
- JSON to CSV — Convert an array of objects into a downloadable CSV.
- CSV to JSON — Parse CSV text or files into a JSON array.
- JSON to Excel — Export an array of objects as an .xlsx workbook.
- Excel to JSON — Upload an Excel file and convert sheets to JSON.
- JSON to XML — Convert JSON structures into well-indented XML.
- XML to JSON — Parse an XML document into an equivalent JSON object.
- JSON to YAML — Convert JSON into more readable YAML.
- YAML to JSON — Parse YAML config into standard JSON.
- JSON to SQL — Generate INSERT statements and CREATE TABLE DDL from arrays.
- SQL to JSON — Reverse-engineer JSON data from INSERT statements.
- JSON ⇄ Cookie — Convert between Cookie strings and JSON key-values.
- JSON Diff — Recursively compare two JSON documents, marking add/delete/change.