How to use
Run a clean first pass
- Paste YAML or JSON into the left input panel.
- Use the ⇄ swap control to pick the direction (YAML → JSON or JSON → YAML).
- Click Convert — parse errors show the failing line below the input instead of a blank panel.
YAML 與 JSON 雙向即時互轉,純前端解析,支援巢狀結構與多行區塊。 Two-way YAML ↔ JSON conversion in your browser — nested structures, multiline blocks, and inline line-number errors.
輸入
YAML
YAML → JSON
輸出
JSON
JSON 是 YAML 的子集——這表示每份合法的 JSON 同時也是合法的 YAML。這個工具使用打包的 js-yaml(MIT 授權)在瀏覽器本機解析 YAML,再以 JSON.stringify 或 yaml.dump 序列化輸出,沒有任何資料傳送至外部伺服器。
JSON is a subset of YAML — meaning every valid JSON file is also valid YAML. This tool uses the bundled js-yaml library (MIT) to parse YAML locally in your browser, then serializes output via JSON.stringify or yaml.dump. No data leaves your device.
解析器使用 js-yaml 的 load()(安全模式)與 dump(),支援巢狀 map 與序列、引號字串、多行區塊(literal | 與 folded >)、null、boolean、數字,以及基本的錨點(&name)與別名(*name)。解析失敗時會顯示行號與欄位,而非空白輸出。
The parser uses js-yaml's load() (safe mode) and dump(), handling nested maps and sequences, quoted strings, multiline literal (|) and folded (>) blocks, null, boolean, numbers, and basic anchors (&name) and aliases (*name). Parse failures show a line/column hint instead of a blank panel.
不支援範圍:YAML 1.1 複雜 merge key 解析、JSON Schema / YAML Schema 驗證、大型檔案串流(建議 500 KB 以下)、檔案上傳,以及 TOML、XML 等其他格式。 Out of scope: complex YAML 1.1 merge-key resolution, JSON Schema or YAML Schema validation, large-file streaming (keep under ~500 KB), file upload, and other formats like TOML or XML.
Quick guide
Compact below-tool notes that help first-run users and repeated visitors move faster without changing the main interface.
Chinese search: YAML 轉 JSON、JSON 轉 YAML、YAML JSON 轉換、YAML 轉換器、線上 YAML 轉 JSON
How to use
Examples
FAQ
No. All parsing and conversion happen locally using the bundled js-yaml (MIT) library and the native JSON parser. Nothing is sent to any server.
Yes. It handles nested maps, sequences, quoted strings, multiline literal (|) and folded (>) blocks, null, boolean, and number scalars.
The output panel clears and an inline message appears below the input with the parser's line/column (when available) plus a plain-language hint — never a silent blank result.
Basic anchors (&) and aliases (*) are expanded, and an Anchor Resolution Trail panel lists each anchor and where it was referenced. Complex YAML 1.1 merge-key resolution is out of scope.