How to convert YAML to JSON
- 1Paste your YAML into the YAML Input panel. The JSON updates automatically a moment after you stop typing.
- 2Watch the badge next to the panel title. Valid YAML means it parsed cleanly; Invalid YAML opens a banner with the parser error, including the line and column.
- 3Read the result in the JSON Output panel, formatted with 2-space indentation.
- 4Click Copy to grab the JSON, or Download to save it as converted.json.
What happens when YAML becomes JSON
YAML is built for humans: indentation instead of braces, comments, and very few quotes. JSON is built for programs: strict, explicit and supported by every language's standard library. You convert YAML to JSON to hand a config file to a tool that only speaks JSON, or to check what a YAML file actually means once all its shortcuts are resolved. A .yml file is the same format under a different extension, so YML to JSON works exactly the same way.
Some YAML features have no JSON equivalent, so they are resolved during conversion. Comments are dropped. Anchors (&name) and aliases (*name) are expanded, so a block reused five times appears five times in the JSON. Merge keys (<<: *defaults) are applied, which makes the output a handy way to confirm what a templated CI file really contains.
Type resolution is where YAML surprises people. Unquoted values are typed by the parser: 42 becomes a number, true becomes a boolean, ~ and null become null, and an unquoted date like 2024-01-15 is read as a timestamp and written to JSON as an ISO 8601 string. This converter follows the YAML 1.2 core rules used by js-yaml 4, so the old YAML 1.1 trap where no, off or NO (the Norway country code) turned into false does not apply. Those stay strings. If you need a value to be a string, quote it in the YAML.
The converter reads one YAML document. Files that contain several documents separated by --- lines, which is common in Kubernetes manifests, will report an error. Paste one document at a time. Everything runs in your browser, so secrets in the config stay on your machine.
When developers reach for it
Debugging config files
Convert a docker-compose.yml or Helm values file to JSON to see exactly how indentation and types were interpreted.
Feeding JSON-only tools
Turn YAML into JSON for jq, a JSON Schema validator, or an API that only accepts application/json.
Expanding anchors and merge keys
Check the fully resolved result of a CI pipeline or OpenAPI spec that reuses blocks with & and *.
Validating YAML syntax
Use it as a YAML checker: paste a file that won't load and use the line and column in the error to find the bad indentation or stray tab.
Frequently asked questions
Why did my comments disappear?
+
JSON has no comment syntax, so comments are discarded when the YAML is parsed. Keep the YAML file as your source of truth if the comments matter.
Can I convert a YAML file with multiple documents (---)?
+
No. The converter loads a single document and reports an error if it finds more than one. Split the file and convert each document separately.
Does "no" or "yes" turn into false or true?
+
Not here. The parser follows YAML 1.2, where only true and false (in lower, title or upper case) are booleans. Words like yes, no, on and off stay strings.
How are anchors and aliases handled?
+
They are expanded. Every *alias is replaced with a full copy of the anchored value, and << merge keys are applied, because JSON has no way to express references.
What happens to dates in my YAML?
+
Unquoted values like 2024-01-15 or 2024-01-15T10:00:00Z are parsed as timestamps and written to JSON as ISO 8601 strings in UTC. Quote the value in the YAML if you want the original text kept exactly.
How do I validate YAML without converting it?
+
Paste it in and read the badge. Valid YAML means the parser accepted the whole document; Invalid YAML shows the error with its line and column. This is a syntax check only, so it won't tell you whether a Kubernetes manifest or GitHub Actions workflow matches that tool's schema.
Can I use it as a YAML parser online?
+
Yes. The JSON output is exactly what js-yaml 4, a widely used JavaScript YAML library, produces from your input, so you can see how a Node.js script using js-yaml will read the file: which values became numbers, booleans, null or dates, and how anchors resolved.
Is my YAML sent to a server?
+
No. Unlike a YAML to JSON online service that posts your file to a backend, this page parses and converts in your browser with the js-yaml library. Nothing is uploaded.
Related tools
JSON to YAML Converter
Quickly transform your JSON data into clean, formatted YAML. Features real-time validation, syntax highlighting, and easy copying.
JSON Formatter
Format and beautify JSON data with syntax highlighting and validation.
JSON to CSV Converter
Convert JSON arrays to CSV and CSV back to JSON. Handles quoted commas and multi-line fields, flattens nested objects to dot-path columns, and supports comma, semicolon, tab and pipe delimiters.
XML to JSON Converter
Convert XML to JSON with attributes and repeated elements handled, or convert JSON back to XML. Options for prefixes, arrays and types; nothing is uploaded.
Base64 Decoder & Encoder
Encode text or files to Base64 format or decode Base64 strings.