JSON ⇄ YAML
JSON and YAML, converted both ways.
Switch between JSON and YAML quickly: turn JSON into readable YAML config, or YAML into parseable JSON. Supports nested objects, arrays and comments — all in your browser.
Everything runs locally in your browser
How to use
Pick a direction, paste JSON or YAML into the input, hit Convert to see the result on the right, then Copy result. YAML uses indentation for nesting and # for comments; failures are shown in the status bar.
FAQ
Does it handle complex structures?
Yes — nested objects, arrays and any combination. The YAML parser covers common block styles (mappings, sequences, scalars, inline comments) but not advanced features like anchor/alias.
Is my data uploaded?
No. All parsing and serialization happen in your browser; nothing is sent to a server.
示例与注意事项Example & notes
一个例子A worked example
把一段 k8s 配置(YAML)转成 JSON 喂给接口:粘贴 → 转换 → 复制结果,键名与层级保持一致。Turn a Kubernetes manifest from YAML into JSON for an API: paste, convert, copy — keys and nesting are preserved.
注意事项Things to watch
- YAML 1.1 里 yes/no/on/off 会被当作布尔值,容易踩坑;转换后请核对目标格式的期望类型。In YAML 1.1 yes/no/on/off parse as booleans — check that the target format expects that.
- 锚点与引用(& 定义、* 引用)会被展开成具体值,文件会变长但语义不变。Anchors and aliases (& and *) are expanded into concrete values: longer output, same meaning.
- 注释在转换过程中会丢失,需要保留注释就不要用它做转换。Comments are dropped during conversion, so keep the original if comments matter.
相关问答More Q&A
转换会改变数据内容吗?Does conversion change my data?
不会改变语义,但缩进会重排、注释与锚点引用会丢失,键顺序在 JSON 中不保证。Semantics stay the same, though indentation is rewritten, comments and anchors vanish, and key order is not guaranteed in JSON.
多大文件比较合适?How large can the file be?
建议 10MB 以内;更大的配置建议用命令行工具处理,避免浏览器卡顿。Stay under roughly 10 MB; larger files are better handled by command-line tooling.