YAML to JSON Converter
Convert YAML data to JSON format instantly. Paste text or upload a .yaml file.
No data sent to serverRelated Tools
What is YAML to JSON?
YAML (YAML Ain’t Markup Language) is the standard config format for modern DevOps — Kubernetes, Docker Compose, GitHub Actions, Ansible, dbt. JSON is the standard data format for APIs and programming. Converting YAML → JSON is needed when you want to consume config files in code, validate against JSON Schema, or integrate with JSON-only tools.
Common scenarios: parsing Helm values.yaml in CI scripts, validating Kubernetes manifests with JSON Schema validators, OpenAPI spec consumption (most tools require JSON), config file unit tests (easier to compare structured JSON), API request bodies from YAML templates.
Conversion example
# YAML
name: myapp
ports:
- 80
- 443
env:
DEBUG: false
PORT: 3000
# Comments are preserved during edit but
# stripped during YAML→JSON (JSON has no comments)
# JSON
{
"name": "myapp",
"ports": [80, 443],
"env": { "DEBUG": false, "PORT": 3000 }
}What’s lost in conversion
- Comments: JSON has no comment syntax — all
#lines are stripped - Anchors / aliases:
&name/*nameare inlined (data preserved, structure flattened) - Multi-line string formatting:
|and>styles become regular JSON strings with\nescapes - Document separators:
---markers between multiple YAML docs are not represented in JSON (need to convert each separately) - Tags:
!!str,!!floatexplicit type tags become inferred JSON types
Watch out for type coercion
YAML’s permissive type inference can produce surprises that show up in JSON output:
- Booleans:
NO,yes,off,onbecome true/false (Norway problem) — quote them as strings to preserve text - Numbers:
1.0becomes number 1.0; quote as“1.0”if you mean version string - Octals:
0644in YAML 1.1 becomes 420 decimal (file permissions trap) - Null: empty values,
null,~,NULLall become JSON null - Dates: ISO date strings may be parsed as Date objects; quote to keep as string
How to Use
- Paste YAML data, or upload a
.yaml/.ymlfile. - Click Convert.
- Review the JSON — verify type coercions (especially for boolean-looking strings, version numbers).
- Copy or download as
.json.
Privacy: Conversion runs in your browser via js-yaml. No upload.
Why Configuration Ended Up in YAML
JSON is excellent for machines and irritating for humans editing configuration by hand: no comments, mandatory quotes, and a trailing comma breaks the whole file. YAML was designed to fix exactly that, which is why Kubernetes manifests, GitHub Actions workflows, Docker Compose files, and CI pipelines are all written in it.
YAML is a strict superset of JSON, so every valid JSON document is already valid YAML. The conversion in this direction is therefore lossless in structure — the only thing that disappears is what JSON has no way to represent.
What Is Lost, and the Famous Gotchas
Comments. YAML’s single biggest advantage over JSON, and JSON has nowhere to put them. Expect every explanatory comment to vanish.
Anchors and aliases. YAML can define a block once and reference it repeatedly. Those references are resolved and inlined during conversion, so the data is preserved but the deduplication is not.
The Norway problem. In older YAML versions, the unquoted value no parses as boolean false — which famously turned the country code for Norway into false in a lot of configuration files. The same applies to yes, on, and off. Quoting such values is the fix.
Sexagesimal numbers. Older YAML treats 22:30 as a base-60 number rather than a time string. Another argument for quoting anything that is not obviously a number.
Indentation with tabs. YAML forbids tabs for indentation entirely, which produces confusing errors in editors configured to insert them.
FAQ
Are YAML anchors and aliases supported?
Yes — js-yaml handles anchors (&name), aliases (*name), and merge keys (<<) correctly. They’re inlined during conversion (data preserved, references resolved).
Does it support multi-document YAML?
Currently only the first document is converted. For multi-document YAML (separated by ---), split into separate documents and convert each.
Why is my NO string showing as false in JSON?
YAML’s Norway problem — it coerces NO, yes, off, on to booleans. Quote them as “NO”, “yes” in your YAML source to preserve as strings.
My version “1.0” became a number — how to keep as string?
Quote it: version: “1.0” instead of version: 1.0. Without quotes, YAML treats it as a number.
What if my YAML has parse errors?
Common errors: tabs in indentation (only spaces allowed), missing colons after keys, inconsistent indent levels. Use a YAML linter (yamllint) to identify issues.
Why does the JSON output not have comments?
JSON spec doesn’t allow comments. They’re stripped during conversion. For “JSON with comments”, use JSONC (VS Code’s flavor) — but strict JSON parsers will reject it.
Will my comments survive?
No. JSON has no comment syntax, so all comments are dropped. Keep the YAML as your editable source and treat the JSON as generated output.
What happens to anchors and aliases?
They are resolved and inlined, so the resulting data is complete and correct but the shared references become duplicated content.
Why did my value ‘no’ become false?
That is the Norway problem — YAML historically parses unquoted no, yes, on, and off as booleans. Quote the value in your YAML to keep it as text.
Are multi-document YAML files supported?
A file with multiple documents separated by three hyphens does not map onto a single JSON value. Convert one document at a time.
⚠️ Reference Only
Output is generated based on your input and is provided for reference. Results may vary depending on your specific use case, edge cases, or environment-specific behavior. We do not guarantee accuracy of conversions, validations, or computed values.
Always verify critical outputs against official documentation or production environments. We are not responsible for any decisions or losses based on these tool results.