YAML to JSON

Paste valid YAML data with proper indentation

Upload Your YAML Files

Drag & drop .yaml / .yml files here or click to browse

Supported: YAML, YML  ·  Max 10 files  ·  20 MB each

The YAML to JSON Converter by AllFileTools is a fast and reliable tool that converts YAML configuration files into clean, structured JSON with complete accuracy. Since YAML is widely used for configuration and JSON powers modern APIs and web applications, this converter makes it easy to move between the two formats without losing data, nesting, or structure. Whether you're a developer, DevOps engineer, or system administrator, it provides a smooth, error-free conversion every time.

Why Convert YAML to JSON

YAML is what you write config files in. JSON is what almost everything else expects — APIs, most parsers, most databases, most "paste this into a schema validator" tools. The conversion looks trivial until you hit one of YAML's quirks (more on that below), which is usually the moment people go looking for a converter instead of trusting kubectl or a hand-rolled script.

Typical reasons people end up here:

  • API integration — you've got a YAML config and need to send it as a JSON payload to a REST API.
  • Debugging Kubernetes output — kubectl get pod -o yaml gives you YAML, but you want JSON to pipe into jq or a script.
  • Schema validation — JSON Schema tooling is more mature than YAML Schema tooling, so people convert first, validate second.
  • Working in a language with weak YAML support — plenty of languages parse JSON natively but need an extra library for YAML. Converting once and working with JSON afterward is often simpler.
  • Generating documentation — turning a YAML config file into a JSON example block for docs or a README.

The Gotchas: Why YAML to JSON Isn't Always 1:1

This is the part most converters don't tell you, and it's the reason a "simple" conversion sometimes produces JSON that's technically valid but not what you meant.

The Norway Problem. In YAML 1.1, unquoted NO, YES, ON, OFF, TRUE, and FALSE are all interpreted as booleans — not strings. So a country-code list like this:

yaml

countries:
  - NO   # becomes false
  - SE
  - FR

...silently turns Norway's country code into the boolean false in your JSON output. This is a real, well-known bug that has bitten actual production systems. Quote anything that should stay a string: "NO".

Leading zeros become octal. zip: 01234 in YAML can be parsed as an octal number, not the string "01234". Quote it if it's meant to be a string.

Version numbers lose precision. version: 1.0 gets read as the number 1, not the string "1.0" — which matters a lot if your JSON output feeds into something that checks for an exact version string. Write version: "1.0" in your YAML source if this matters to you.

Anchors and aliases get expanded, not preserved. YAML's &anchor / *alias references (used to avoid repeating the same block twice) are fully resolved into their expanded values in JSON, since JSON has no equivalent shorthand. That's expected — just don't expect to see the anchors in your output.

Comments disappear. JSON has no comment syntax, so any # notes in your YAML are gone after conversion. There's no way around this; if the comments matter, keep the original YAML file alongside the JSON.

Multi-document YAML needs splitting. A single YAML file can contain multiple documents separated by ---. If yours does, each document typically converts to a separate JSON object — a single JSON file can't represent multiple root-level documents the way YAML can.

YAML vs JSON at a Glance

  YAML JSON
Best for Config files, human editing APIs, machine-to-machine data
Comments Supported (#) Not supported
Implicit typing Yes — this is where the gotchas above come from No — everything is explicit
Multi-document Yes, via --- No native equivalent
Parsing More forgiving, more surprises Stricter, fewer surprises

How to Use This Tool

  1. Paste your YAML into the input box, or upload a .yaml/.yml file.
  2. Click Convert to JSON.
  3. Check the output — the tool flags ambiguous values (booleans, octal-looking numbers) instead of silently mis-typing them.
  4. Copy the result or download it as a .json file.

What This Converter Handles

  • Correct type resolution — booleans, numbers, and strings are parsed according to the YAML spec, with ambiguous cases (like the Norway Problem above) handled deliberately rather than guessed at.
  • Anchors and aliases — fully resolved into their expanded JSON values, so nested repeated structures come out correct instead of broken.
  • Multi-document YAML — files with --- separators are detected and converted appropriately.
  • Batch conversion — upload multiple .yaml files together and download everything as one ZIP.
  • Large file support — big Kubernetes manifests or Ansible inventories convert without the browser choking; the preview may truncate on very large output, but the downloaded file is always complete.

Prefer the Command Line?

If you're doing this often enough that a browser tab feels slow, the same conversion works from a terminal:

bash

# Using yq
yq -o=json config.yaml > config.json

# Using Python
python -c "import yaml, json, sys; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=2)" < config.yaml

Both approaches hit the same gotchas described above — quoting matters just as much on the command line as it does here.

Security & Privacy

Uploaded YAML files and pasted content are used only to generate your JSON output. Files are automatically deleted from our servers within 1 hour — nothing is stored, logged, or reused. If your YAML contains secrets or credentials, strip them before pasting into any online tool, this one included.

Frequently Asked Questions

Why did my "NO" or "YES" value turn into true/false?

This is a known YAML behavior called the Norway Problem — unquoted NO, YES, ON, OFF, TRUE, and FALSE are interpreted as booleans in YAML 1.1. Quote any value that should stay a string, like "NO", and it will convert correctly.

Will my YAML comments show up in the JSON output?

No. JSON doesn't support comments, so any # notes in your YAML are dropped during conversion. Keep the original YAML file if you need those notes later.

What happens to YAML anchors and aliases?

They're resolved into their full expanded values. JSON has no shorthand for repeated structures, so the output contains the complete data at every point the anchor was referenced.

Can this tool handle multi-document YAML files (with --- separators)?

Yes. Files containing multiple YAML documents are detected and each document is converted appropriately.

Can I convert multiple YAML files at once?

Yes, batch upload is supported. Upload several .yaml or .yml files together and download all converted JSON files in a single ZIP.

Is there a file size limit?

The tool handles typical config files and Kubernetes manifests without issue. Very large files may take a moment longer, and the on-screen preview may truncate, but the downloaded file always contains the full, untruncated output.

Does this tool store my data?

No. Your YAML is processed to generate the JSON output and deleted from our servers within 1 hour. Nothing is logged or shared.

What if my YAML has a syntax error?

The tool validates your YAML before converting. If something's malformed — bad indentation, a missing colon, mismatched anchors — you'll get a specific error instead of a broken or silently wrong JSON output.

Do I need to sign up?

No. It's free and browser-based — paste your data or upload a file and convert, no account required.