Format Code Now
/
ConvertYAML and JSON Converter Next: Unix Timestamp Converter ›

YAML Validator and YAML to JSON Converter

CV-03

Paste YAML and press YAML to JSON. If it is valid you get the JSON, and if not you get the error with its line and column. JSON to YAML works the other way. Everything runs in your browser and nothing is uploaded.

Runs in your browser. Nothing is uploaded.

YAML or JSON

Result

How to use it

  1. Paste your YAML into the input box.
  2. Pick an indent size if you want a different JSON layout.
  3. Press YAML to JSON. Valid YAML turns into JSON, and a syntax error shows its reason with the line and column.
  4. To go the other way, paste JSON and press JSON to YAML.
  5. Copy the result, or fix the line the error points to and run it again.

Checking YAML syntax

There is no separate validate button. YAML to JSON parses the whole text, so the answer is the same: valid YAML produces JSON, and invalid YAML produces the parser's reason plus the line and column where it stopped. This checks syntax only. It does not know whether your keys are correct for Kubernetes, Docker Compose, GitHub Actions or any other format, so a file can pass here and still be rejected by the tool that reads it.

What the loader accepts

The converter uses the safe YAML loader, so custom tags are rejected and no code is executed. Anchors and merge keys are resolved into plain values. It reads one document, so a file with several --- sections needs to be split. The words yes, no, on and off stay text, and dates such as 2026-01-01 stay text. A repeated key at the same level is reported as an error.

JSON to YAML and large numbers

JSON to YAML parses your JSON first and then writes block-style YAML with 2 or 4 space indents and no line wrapping. If the input is not valid JSON you get a message that starts with Input is not valid JSON. Whole numbers longer than 15 digits can lose precision in both directions here, so keep long IDs as strings or format them with a JSON tool that preserves numbers.

Error messages and what to do

MessageWhat it meansFix
bad indentation of a mapping entry at line 3, column 5A key is indented differently from the other keys at its level, or a child key is not indented under its parent.Use the same number of spaces for every key at one level and indent children by at least one more space.
can not read a block mapping entry; a multiline key may not be an implicit key at line 4, column 3A line inside a mapping has text but no key: value pair, often a missing colon or a value that continues onto a new line.Add the missing colon, or put the text on one line or inside quotes.
duplicated mapping key at line 6, column 1The same key appears twice in one mapping.Delete one of them or rename it.
tab characters must not be used in indentation at line 2, column 1The line is indented with a tab. YAML allows spaces only.Replace the tab with spaces.
unidentified alias "base" at line 8, column 10An alias such as *base points to an anchor &base that is not defined earlier in the document.Define the anchor before the alias and spell the name exactly the same.
expected a single document in the stream, but found moreThe text has more than one document separated by ---.Convert one document at a time, or remove the extra --- sections.

Questions people ask

How do I validate YAML online?

Paste it into the box and press YAML to JSON. If the YAML is valid you get JSON. If not, you get the reason and the line and column of the first problem. This checks syntax, not whether the keys fit your application.

Does it check Kubernetes or Docker Compose files against a schema?

No. It checks that the text is valid YAML. It does not know which keys a Kubernetes manifest, a Compose file or a CI workflow should have, so a schema or the tool's own validate command is still needed for that.

How do I convert YAML to JSON?

Paste the YAML and press YAML to JSON. Choose 2 spaces, 4 spaces or a tab for the JSON indent first. Anchors and merge keys are resolved into plain values, and the conversion runs in your browser with nothing uploaded.

How do I convert JSON to YAML?

Paste the JSON and press JSON to YAML. The output is block-style YAML. If the JSON has a syntax error you see a message starting with Input is not valid JSON and the reason from the parser.

Why does YAML say tab characters must not be used in indentation?

YAML does not allow tabs for indentation, only spaces. Your editor probably inserted a tab. Replace the tab on the line named in the error with spaces, matching the indent of its sibling lines.

Can it convert YAML with several documents?

No. It reads a single document and reports that it expected a single document if it finds more than one separated by ---. Split the file and convert each document on its own.

About this tool

Uses the safe YAML loader, so no custom tags or code are executed. Anchors and merge keys are resolved. Whole numbers longer than 15 digits can lose precision here; use the JSON Formatter to keep those exact.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.