JSON转YAML
把 JSON 转为可读性更好的 YAML。
关于「JSON转YAML」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- YAML 依靠<b>缩进</b>表达层级,比 JSON 少了大量括号和引号,更适合写配置文件。
- 只有在必要时才会给字符串加引号,可通过选项指定偏好单引号还是双引号。
- <code>noRefs</code> 已开启:重复出现的对象会完整展开,不会生成 <code>&anchor</code> 引用。
- 换行宽度控制长字符串在多少列处折行,设大一些可以避免不必要的折叠。
- 注意 YAML 中缩进必须使用<b>空格</b>,制表符是非法的。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON转YAML、JSON 工具、yaml、yml、在线工具、免费
如何使用「JSON转YAML」
- 打开工具:打开「JSON转YAML」页面,无需注册、无需安装任何软件。
- 准备输入:准备好要处理的内容或文件:文本可直接粘贴,文件可拖入页面(本工具属于「JSON 工具」)。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- YAML 相比 JSON 有什么优势?
- YAML 去掉了花括号、方括号和大部分引号,还支持注释,写起来更简洁、读起来更清晰,因此 Kubernetes、CI 流水线、各类服务配置普遍采用它。
- 转换会丢失数据吗?
- 不会。YAML 是 JSON 的超集,任何合法 JSON 都能无损表示为 YAML,用配套的「YAML转JSON」可以完整还原。
- 为什么有些字符串被加了引号?
- 当字符串可能被误解析成其它类型时必须加引号,比如 <code>yes</code>、<code>no</code>、<code>null</code>、纯数字,或者以特殊符号开头的内容。
JSON to YAML (English)
Convert JSON into more readable YAML.
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- YAML uses <b>indentation</b> for hierarchy — fewer braces and quotes than JSON, ideal for config files.
- Strings are quoted only when needed; you can prefer single or double quotes via options.
- <code>noRefs</code> is on: repeated objects are fully expanded, no <code>&anchor</code> references are generated.
- Line width controls where long strings wrap; a larger value avoids unwanted folding.
- Note: YAML indentation must use <b>spaces</b>; tabs are illegal.
Free, no sign-up; everything runs locally in your browser and files are never uploaded.
Keywords: JSON to YAML, JSON Tools, yaml, yml, online tool, free
How to use it
- Open the tool:Open the “JSON to YAML” 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
- What are YAML's advantages over JSON?
- YAML drops braces, brackets and most quotes, and supports comments — cleaner to write and read, which is why Kubernetes, CI pipelines and many service configs use it.
- Will conversion lose data?
- No. YAML is a superset of JSON, so any valid JSON maps losslessly to YAML and can be fully restored with the companion "YAML to JSON" tool.
- Why are some strings quoted?
- Strings are quoted when they could be misparsed as another type, e.g. <code>yes</code>, <code>no</code>, <code>null</code>, bare numbers, or values starting with special symbols.
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.
- 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 to Base64 — Convert JSON to and from Base64 with UTF-8 support.
- JSON ⇄ Cookie — Convert between Cookie strings and JSON key-values.
- JSON Diff — Recursively compare two JSON documents, marking add/delete/change.