CodeMash

YAML to JSON Converter Online — Free

Convert YAML documents to JSON format with proper type inference.

Ad Space

Frequently Asked Questions

How do I convert YAML to JSON?

Paste your YAML content into the input box. Our converter parses the YAML and outputs valid JSON instantly in your browser. Supports YAML 1.2 spec.

Does this handle YAML anchors and aliases?

Yes, YAML anchors (&) and aliases (*) are fully resolved during conversion to produce valid JSON output.

Can I convert Kubernetes YAML to JSON?

Absolutely. Our converter handles complex Kubernetes, Docker Compose, and CI/CD configuration YAML files with proper type inference.

Are YAML comments preserved?

JSON does not support comments, so YAML comments are stripped during conversion. The data structure is fully preserved.

Privacy First: All processing happens directly in your browser. Your data never leaves your device.

About YAML → JSON

YAML is a superset of JSON, so every valid JSON document is already valid YAML. Converting the other direction is where the interesting cases live, because YAML expresses several things JSON simply cannot.

What YAML has that JSON does not

  • Comments. Everything after a hash is stripped, and there is nowhere to put it in the output — this is the one genuinely lossy part of the conversion.
  • Anchors and aliases, which let a document reuse a node. These are expanded inline, so shared structure becomes duplicated data.
  • Multiple documents in one file, separated by three dashes. JSON has no equivalent; only a single document converts cleanly.
  • Multi-line block scalars, which become ordinary JSON strings with embedded newlines.
  • Non-string keys. YAML permits a mapping keyed by a number or a boolean; JSON keys are always strings.

The Norway problem

YAML 1.1 interprets a set of unquoted bare words as booleans, which is a well-documented source of production incidents. The country code NO becomes false, and so do the bare words no, off and n; yes, on and y become true.

The same class of surprise applies to values that look numeric. A version string written as 1.10 becomes the number 1.1, and a git SHA consisting only of digits may be read as a very large number. If a scalar must stay a string, quote it in the YAML — this is not something the converter can infer on your behalf.

Indentation errors

YAML structure is defined entirely by indentation, and tabs are forbidden as indentation characters — an editor configured to insert tabs will produce files that fail to parse with an error pointing at a line that looks visually correct. If a document refuses to parse and the offending line appears fine, check for literal tab characters first.