YAML to JSON

Paste your YAML and get clean JSON output instantly. Everything runs in your browser — nothing is sent to any server.

Paste your YAML to get started
YAML Input
JSON Output

Frequently Asked Questions

What YAML features are permanently lost when converting to JSON?

JSON has no equivalent for: (1) comments — all # comments are stripped silently; (2) anchors and aliases — &anchor / *alias pairs are resolved (the referenced value is inlined) so the deduplication is lost; (3) block scalars — multi-line | (literal) and > (folded) strings are collapsed into a single-line JSON string with \n characters; (4) custom type tags — these are either stripped or cause a parse error. If you need to preserve comments or anchors for re-editing, keep your canonical source in YAML and treat JSON as a read-only export.

Can valid YAML fail to convert to JSON?

Yes. YAML allows non-string keys — you can have an integer, boolean, or even an object as a map key. JSON only allows string keys. A YAML document with {42: value} (integer key) will either fail conversion or produce {"42": value} with the key coerced to a string. YAML also allows multiple documents in one file (separated by ---), which JSON cannot represent as a single value. YAML with circular references (created via anchors) cannot be serialized to JSON at all.

How does YAML implicit type coercion affect the converted JSON output?

YAML parsers infer types from unquoted scalars. The value on becomes true, 2023-01-15 becomes a date object, 1_000 becomes integer 1000, and 1e3 becomes float 1000.0. When written to JSON, they appear as their typed values, not as the original strings from the YAML file. This is especially problematic with version numbers like 1.10, which YAML 1.1 parsers interpret as the float 1.1, losing the trailing zero. If you intended those as strings, they must be quoted in the YAML source.

What is the difference between YAML 1.1 and YAML 1.2, and why does it matter?

YAML 1.1 (2005) has an extended set of boolean aliases (yes, no, on, off, y, n, true, false — case-insensitive), uses different timestamp format, and interprets octal literals with a leading 0. YAML 1.2 (2009) reduced booleans to only true and false and aligned more closely with JSON semantics. Many widely-used libraries (PyYAML, Go's yaml.v2) still default to YAML 1.1. If a converter uses a 1.1 parser, No in your YAML becomes false in JSON — the Norway problem that silently broke many systems.

How should I handle a multi-document YAML file (separated by ---) when converting to JSON?

JSON has no standard envelope for multiple documents in a single file. The common approaches are: output a JSON array where each element is one YAML document; output one JSON file per document; or output NDJSON (Newline-Delimited JSON, one object per line). Be aware that most simple converters only process the first document and silently ignore the rest — always verify the output when your YAML file uses --- separators.