Developer

YAML to JSON

Convert YAML to JSON in your browser, with the type-coercion traps that silently change values during conversion.

Last reviewed by the Radiatus Cloud team

YAML to JSON

Convert YAML configuration files to JSON format.

Need this built for your product?

We design, build & host secure software & APIs.

Talk to an engineer

YAML is a superset of JSON

Every valid JSON document is already valid YAML, which is why JSON to YAML is always clean. The reverse loses things YAML has and JSON does not: comments, anchors and aliases, multiple documents in one file, and several distinct multi-line string styles. In a configuration file the comments are frequently the most valuable content, and they vanish silently.

The Norway problem

YAML 1.1 reads a set of unquoted scalars as booleans: yes, no, on, off, true, false and their capitalised forms. The country code for Norway is NO, so an unquoted list of country codes converts Norway to the boolean false. The same class of bug turns version 1.10 into the number 1.1, and reads a time like 12:30 as a sexagesimal number in older parsers. Quote any scalar whose type you care about.

Indentation is the syntax

YAML uses indentation for structure and forbids tabs entirely, because tab width is ambiguous. A single stray tab produces a parse error that most editors render invisible. Configure your editor to insert spaces and to show whitespace before debugging anything else.

Anchors expand

An anchor marks a node and an alias reuses it, which avoids repetition in long configurations. JSON has no equivalent, so each alias is expanded into a full copy. The output is correct and longer, and the shared relationship is gone, so round-tripping back to YAML will not restore it.

Multi-line strings

The literal style with a pipe preserves newlines; the folded style with a greater-than sign joins lines into a paragraph. Each takes a chomping indicator controlling trailing newlines. Getting this wrong is how an embedded shell script in a CI configuration ends up with its lines concatenated into one unrunnable command.

Related tools

  • JSON Formatter — Format and beautify JSON in your browser. Pinpoints syntax errors by line and column, flags unsafe integers, and never uploads your data to a server.
  • JSON Validator — Validate JSON syntax with precise line and column errors, and check documents against a JSON Schema. Runs locally in your browser, nothing uploaded.
  • Regex Tester — Test regular expressions against sample text with live match highlighting, capture groups and flag control. Runs entirely in your browser.
  • HTML Minifier — Minify HTML by removing comments and redundant whitespace, without breaking inline elements or pre blocks. Runs entirely in your browser.

Frequently Asked Questions

Why did my country code NO become false?

YAML 1.1 treats unquoted no, yes, on and off as booleans. Quote any scalar whose type matters. The same issue turns version 1.10 into 1.1 and can read 12:30 as a number.

What is lost converting YAML to JSON?

Comments, anchors and aliases, multi-document files and the distinct multi-line string styles. Comments matter most, since in configuration they often carry the reasoning.

Can I use tabs in YAML?

No. The specification forbids tabs for indentation because tab width is ambiguous. A single tab causes a parse error that most editors render invisible.

What happens to anchors and aliases?

Each alias is expanded into a full copy, because JSON has no equivalent. The data is correct but longer, and converting back to YAML will not restore the anchors.

Which multi-line style should I use?

A pipe preserves newlines exactly, which is what embedded scripts need. A greater-than sign folds lines into a paragraph. Both accept chomping indicators for trailing newlines.

Privacy & Security

Local processing.

Data: None
Client-side-Side
Active
v1.0

About This Tool

This tool runs entirely in your browser. No data is sent to any server, ensuring complete privacy. Simply use the interface above to get started — no registration or login required.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.