Skip to content
Toolew.com

YAML to JSON Converter

Convert YAML to JSON with anchors, merge keys and multi-document support, choosing YAML 1.2 or 1.1 typing rules.

Runs in your browser. Your data is not uploaded.
Loading tool…

This guide is not yet available in your language and is shown in English.

Tool guide

What this tool does

YAML to JSON Converter parses YAML configuration, manifests and data files and outputs formatted or minified JSON. It resolves anchors, aliases and << merge keys, handles files with several --- documents, and lets you choose YAML 1.2 core rules or YAML 1.1 rules where yes, no, on and off are booleans. Syntax errors show the exact line and column.

YAML is pleasant to write but strict to parse. Indentation defines structure, a tab character is an error, and the same unquoted word can be a string or a boolean depending on which YAML version a tool implements. When a deployment or pipeline fails with a vague parse error, converting the file to JSON is the quickest way to see what the parser actually understood.

This converter uses js-yaml, a widely used YAML parser, loaded on demand. By default it follows the YAML 1.2 core schema used by modern tools, where yes and no remain text, and it resolves anchors (&name), aliases (*name) and << merge keys. Switch to YAML 1.1 rules to mimic older parsers such as PyYAML defaults, where yes, no, on and off become booleans and dates become timestamps. Errors are reported with the line, column and a code excerpt, and nothing is uploaded.

How to use YAML to JSON Converter

  1. Paste YAML into YAML input, open a .yaml or .yml file, or click Sample.
  2. Choose the YAML rules: 1.2 core, 1.1, or Everything as strings to keep every scalar as text.
  3. Decide how Multiple documents separated by --- are returned.
  4. Pick the JSON Indentation or Minified.
  5. If an error appears, fix the line and column it points to; the output updates as you type.
  6. Copy or download data.json, or convert several YAML files at once with batch mode.

Tips for better results

  • Compare the 1.2 and 1.1 results to find values like country: NO that different tools would read differently.
  • Merge keys are expanded, so the JSON shows the final values each service really receives, which is useful for debugging Docker Compose and CI templates.
  • Everything as strings is handy for translation files, where values like "Yes" or "1.0" must never change type.
  • An error at column 1 of a line usually means the indentation of that line does not match its siblings.

Common use cases

  • Debugging a Kubernetes, Helm values or GitHub Actions file that fails to load.
  • Feeding YAML configuration into a tool or API that only accepts JSON.
  • Checking how anchors and merges expand before committing a pipeline change.
  • Converting OpenAPI specifications for code generators that need JSON.

Common mistakes to avoid

  • Indenting with tabs, which YAML forbids; use spaces consistently.
  • Forgetting the space after a colon: key:value is a single string, not a mapping.
  • Leaving values like 08 or 1e3 unquoted when they are meant as text; the parser converts or rejects them as numbers.

Frequently asked questions

What is the difference between YAML 1.1 and 1.2 rules?

YAML 1.2 core treats only true and false as booleans and keeps words like yes, no, on and off as strings. YAML 1.1 treats those words as booleans, reads 012 as an octal number and recognises dates. Many older libraries still default to 1.1.

Are anchors and aliases supported?

Yes. Aliases are replaced by a copy of the anchored value, and << merge keys copy the referenced mapping into the current one, with local keys taking priority.

How are multiple documents handled?

By default a file with several --- separated documents becomes a JSON array and a single document stays as it is. You can also always return an array or keep only the first document.

Are YAML comments kept?

No. JSON has no comment syntax, so comments are dropped during conversion. Keep the YAML file as your source of truth if the comments matter.

Feedback & suggestions

Help us improve YAML to JSON Converter. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.