YAML 查看器

YAML 输入

JSON

无数据

关于此工具

YAML Viewer 是现代 DevOps、云基础设施和应用开发中处理 YAML 配置文件人员的必备工具。我每天都用它来调试 Kubernetes 清单、Docker Compose 文件、GitHub Actions 工作流、Ansible playbook 以及各种配置文件。交互式树视图让你一目了然地理解复杂嵌套结构——可展开/折叠节点,专注于特定部分,清晰显示数据类型(字符串、数字、布尔值、数组、对象),轻松浏览大型 YAML 文件而不会迷失在缩进中。JSON 转换功能非常适合验证 YAML 语法并查看解析器如何解释数据。语法验证可在部署前捕捉错误——如缺少冒号、缩进错误、无效锚点或格式错误的数组,均会精确标注行和列号。

使用方法

将 YAML 内容粘贴或上传到输入面板,工具会自动实时解析和验证 YAML。可通过标签切换树视图(交互式分层可视化)、JSON(转换结果)和 YAML(格式化输出)。在树视图模式下,点击任意节点可展开/折叠嵌套结构——使用“全部展开”和“全部折叠”按钮可快速浏览大型文件。任何语法错误都会以详细的错误信息(含行号和列号)高亮显示。支持直接上传 YAML 文件(.yaml、.yml、.txt),文件名会显示以供参考。可将 JSON 或格式化后的 YAML 输出复制到剪贴板或下载保存。

常见使用场景

Kubernetes Debugging

Paste complex K8s deployment YAML and use tree view to verify nested spec.containers.env variables, volume mounts, or resource limits structure.

Docker Compose Validation

Check docker-compose.yml syntax before running docker-compose up—catch indentation errors or invalid service configurations.

GitHub Actions Review

Visualize complex workflow YAML with multiple jobs and conditional steps in an easy-to-navigate tree structure.

Config File Analysis

Parse large application configuration files (Helm charts, Ansible playbooks, OpenAPI specs) to understand the structure without reading hundreds of lines.

YAML to JSON Conversion

Convert YAML config to JSON for use with tools that only accept JSON input (many APIs and CLI tools).

Learning YAML

Use the tree view to understand how YAML indentation maps to nested data structures and how YAML anchors/aliases work.

限制与重要说明

Very large YAML files (>5MB) may cause browser performance issues—for massive files, use command-line tools like yq or yaml-lint. The tool uses JavaScript YAML parser which follows YAML 1.2 spec—some YAML 1.1 features may parse differently. Custom YAML tags (!include, !env, !ref) are not supported as these are preprocessor features requiring external file access. Comments in YAML are preserved in the input display but not included in JSON/tree output (JSON doesn't support comments). For Kubernetes-specific validation (CRD schemas, API versions), use kubectl --dry-run instead. Multi-document YAML files (separated by ---) show only the first document—split multi-doc files for individual viewing. Binary data in YAML (base64 encoded) is shown as-is without decoding.