YAML 转 JSON

YAML 配置转 JSON

YAML 输入

Loading editor...

JSON 输出

Loading editor...

Turn YAML config into JSON your code can parse

Even if you write config in YAML, lots of tools — APIs, JavaScript runtimes, schema validators — only speak JSON. Converting YAML to JSON resolves anchors, expands aliases, and produces a clean object you can feed into validation libraries, request bodies, or app state.

Use the converter when you need to

Validate a YAML manifest with JSON Schema

Most schema validators accept JSON only — convert YAML to JSON first, then run validation.

Send a YAML config as an API request body

Many APIs accept JSON only. Convert your YAML payload before posting it.

Inspect a YAML file as structured data

Convert to JSON, then explore the structure in a viewer or feed it into JSONPath queries.

How to convert YAML to JSON quickly

  1. 1

    Paste the YAML content into the editor.

  2. 2

    Click Convert to produce JSON with anchors and aliases resolved.

  3. 3

    Copy the JSON or feed it into a downstream tool.

Common YAML-to-JSON workflows

Migrate a Kubernetes manifest into JSON tooling

Run schema and policy checks that only accept JSON without rewriting the YAML by hand.

Audit a CI config

Convert .github/workflows YAML to JSON to query the structure programmatically.

Diff config across environments

Convert YAML configs to JSON so you can compare them with structural diff tools.

相关工具

常见问题

粘贴 YAML 内容,点击 Convert。工具会解析 YAML 语法(包括 anchors、aliases、多行字符串等),并输出格式正确的 JSON。

很多 API 只接受 JSON。如果你手头是 Kubernetes manifest、Docker Compose 或 CI/CD 配置(YAML),但需要用代码处理,转成 JSON 后几乎任何编程语言都更好用。

支持。转换时会解析并展开 anchors(&)和 aliases(*),因此输出的 JSON 是完整数据,不包含引用。

工具只处理输入中的第一个 YAML document。如果文件里有用 --- 分隔的多个 document,请分别粘贴后逐个转换。