RevealTheme logo

YAML 轉 JSON 工具

在你的瀏覽器中將 YAML 轉換為 JSON。支援巢狀對應、清單、字串、數字和布林值。

如何使用本工具

  1. 1

    Paste or type your YAML into the input box, using spaces (not tabs) for indentation.

  2. 2

    Read the pretty-printed JSON that appears below the box as you type.

  3. 3

    If a red error message shows instead, check your indentation and remove unsupported syntax.

  4. 4

    Select and copy the JSON output to paste into your config, code, or API client.

什麼是 YAML 轉 JSON 工具?

YAML 和 JSON 都是資料交換格式,能夠表示相同的結構。YAML 對人來說更易讀(沒有大括號或引號),而 JSON 則更具普遍的可剖析性。當你需要將資料輸入到只接受 JSON 的工具中時,在兩者之間轉換是設定檔(GitHub Actions、Docker Compose)的常見需求。

常見使用場景

  • Quickly turning a small docker-compose.yml or GitHub Actions snippet into JSON to inspect its structure.

  • Converting a hand-written config block into JSON to paste into a tool or API that only accepts JSON.

  • Checking how YAML scalars like true, 123, or ~ get typed once they become JSON values.

  • Sanity-checking indentation in a YAML fragment by seeing whether the nesting comes out as you expect.

  • Generating seed JSON fixtures for tests from a more readable YAML draft.

  • Teaching or learning the mapping between YAML structures and their JSON equivalents.

常見問題

支援 YAML 的進階功能嗎?
錨點、別名、多行字串和標籤均不受支援。對於這些情況,請使用 js-yaml 等功能完整的 YAML 剖析器。

相關工具