YAML Formatter
Validate and beautify YAML, convert to and from JSON without escaping CJK — verify K8s / CI configs as you edit.
>_ USAGE GUIDE
Paste YAML to validate syntax and beautify indentation, with two-way JSON conversion built in. While editing Kubernetes manifests, CI/CD configs (GitHub Actions, GitLab CI), or Docker Compose files, run a quick validation after every change — indentation errors surface on the spot, and CJK values stay unescaped and readable after conversion.
- Paste the YAML: any manifest, workflow, or compose file
- Validate and beautify: syntax errors are reported with their line; clean files come back tidily indented
- Convert to JSON and back: a successful conversion proves the structure parses as intended
YAML's classic failures all hide in invisible characters: a Tab sneaking into the indentation, a missing space after a colon, a folded multi-line string. Validation points at the offending line; the JSON round trip is also a great diagnostic — if YAML converts to JSON cleanly, the structure is legal. Keep the tab open beside your editor while iterating on a manifest: the two-second validation loop beats waiting for a deploy to fail. Parsing runs locally with zero uploads.
>_ FAQ
Q1 · Is there a difference between YAML and YML?
None — only file-extension habit: .yml is shorter and older, .yaml is the officially recommended spelling. They denote the same format; what matters is the path your configuration actually references, not the extension's semantics.
Q2 · How do I debug YAML indentation errors?
Three rules cause most failures: use spaces only, never Tabs (mixed use fails immediately — set your editor to expand Tabs); align sibling elements at the same depth; and put a space after every colon and dash. Validation reports the failing line — scan upward from it to the first place where indentation shifts, and nine times out of ten that is the bug. The JSON round trip is the second tool: a clean conversion means the structure was understood.
Q3 · How do I verify a K8s or CI config after editing?
Two layers. First validate the YAML syntax itself here — indentation, types, structure. Then validate the semantics with the target system's own tooling, such as kubectl apply --dry-run=client or your CI's lint command. YAML will not catch a misspelled key like repicas — only the schema-level check does. Both layers are necessary.
Q4 · How do multi-line strings work in YAML?
Block scalars: | preserves line breaks (right for shell scripts and certificates), > folds into one line (right for long descriptions). Chomping indicators such as |- control whether a trailing newline is kept. This is the everyday syntax for inline Dockerfile scripts and K8s ConfigMap contents — write it, then verify the parsed result with this tool.
Q5 · My YAML converted to JSON and the Chinese text became \u escapes — is that bad?
No. JSON permits non-ASCII characters to be stored as escapes, and \u4e2d\u6587 is exactly equivalent to the original characters — any parser produces the same string. Some tools escape for compatibility. This converter keeps CJK text unescaped for readability; either form is semantically identical.