// DEV / YAML-JSON

YAML / JSON 互转YAML ↔ JSON

YAML 与 JSON 双向转换,保留结构,出错时给出行号。Convert between YAML and JSON in both directions, with syntax errors reported.

输出 JSONOutput JSON
等待输入。输入内容后这里会实时显示转换结果。Waiting for input. The conversion will appear here as you type.

转换只保留数据本身,YAML 注释、锚点写法和缩进风格会丢失。Only the data is preserved; YAML comments, anchor style and formatting are lost.

常见问题FAQ

YAML 转 JSON 会丢失什么?What is lost when converting YAML to JSON?

只保留数据本身。YAML 的注释、锚点与别名写法、缩进风格都会丢失,因为这些在 JSON 里没有对应表示。Only the data survives. Comments, anchors and aliases, and indentation style are dropped because JSON has no way to represent them.

解析失败时能定位到哪一行吗?Are parse errors located by line?

能。出错时会显示第几行第几列以及原因,方便对照原文修改。Yes. Errors report the line, column and reason, so you can fix the source directly.

同类工具Related tools

所有计算都在你的浏览器本地完成,输入内容不会上传到任何服务器。Everything runs locally in your browser. Nothing you type is ever uploaded to a server.