YAML to JSON Converter
Validate YAML, normalize indentation, sort keys, and convert YAML to JSON locally in your browser.
YAML Validator & Formatter
Paste in the YAML and choose Format YAML to parse it and re-emit it with consistent two-space indentation. If parsing fails, the tool will report the line and column of the parser and highlight the line involved. If you want to get a JSON representation of the parsed data, select To JSON.
The parser is a YAML schema in JSON style. That keeps auto type resolution to JSON-compatible primitives like strings, numbers, booleans and null rather than constructing language-specific objects. YAML is still richer than JSON: indentation, block sequences, comments, anchors and aliases can make the source concise, but some of that presentation detail is lost when the document is parsed and emitted again.
Formatting and conversion run in your browser.
Common YAML errors
Tabs instead of spaces
YAML forbids tab characters for indentation. Replace all tabs with spaces.
Inconsistent indentation
Child keys must be indented by the same number of spaces relative to their parent.
Unquoted special characters
Characters such as :, -, #, {, and [ have structural meanings in particular positions. Quote a value when the parser could interpret its punctuation as YAML syntax.
Missing space after a colon
In a block mapping, name:Ada is not the same as name: Ada. The space separates the key from its value.
Accidental type changes
If a value looks like a number or boolean it can be parsed as such. Quote identifiers such as ZIP codes or values with significant leading zeroes when they must be strings.
Formatting is a lossy source-code operation
The formatter keeps the data model parsed, not the exact source code . Comments, original quote selections, blank-line formatting, anchor names, and stylistic choices can be lost or vary. Sorting keys is optional and can make a configuration file easier to scan, but can also create a large diff or obscure a deliberate human order.
If you replace a hand-maintained configuration file, do not forget to leave the original under version control and check the output. If comments contain operational knowledge, do not treat a data-only conversion as a safe rewrite.
JSON output still needs a contract check
This parser can serialize the data to JSON as in the YAML to JSON conversion . It does not prove that it is accepted by Kubernetes, GitHub Actions, a CI system or any other application of the fields and values. Check the result against the target system schema or tooling.
FAQ
Why does my YAML fail to parse?
Common causes are indentation, especially tabs or siblings not being aligned. But punctuation, quoting and malformed flow collections can fail too. Go to the reported line and check the line above for an unclosed bracket or quote.
Does formatting preserve comments?
Naw. The tool parses the data and produces a normalized document, so comments and original formatting choices are not guarantyd to survive.
Is valid YAML automatically valid for my configuration system?
No. Validating the application schema and checking the YAML syntax are two different things. After this pass of syntax, use the validator of the platform of destination.