GALAXY OF TOOLS

DEV SECTOR

YAML ↔ JSON Converter

Convert YAML to JSON and JSON to YAML, with multi-document support, anchors and line-numbered errors.

Options

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Convert YAML to JSON and JSON to YAML instantly

The YAML to JSON converter turns configuration files — Kubernetes manifests, Docker Compose files, GitHub Actions and GitLab CI pipelines, OpenAPI specs, Ansible playbooks — into JSON, and converts JSON back into clean, readable YAML. Paste either format, or drop a .yaml, .yml or .json file, and the result updates as you type.

It understands the YAML features real files use: comments, anchors and aliases (&defaults / *defaults), merge keys (<<:), folded and literal block strings, flow collections and multiple documents separated by ---. When something is wrong, you get the line and column, a plain description such as “bad indentation of a mapping entry”, and the surrounding lines with a caret under the problem.

Parsing uses the well-tested js-yaml library, loaded only when you first convert. Your files are processed in your browser and never uploaded.

How to use the YAML ↔ JSON Converter

  1. Choose the direction: YAML → JSON or JSON → YAML.
  2. Paste your data, drop a file on the input, or press Load file — the direction switches automatically for .json files.
  3. Pick the indentation. For YAML with several documents, decide whether to convert them all into a JSON array or only the first.
  4. Fix any error using the line and column shown, then Copy or Download the result.
  5. Press Swap to send the result back the other way and check a round trip.

YAML ↔ JSON Converter features

Both directions

YAML to JSON with 2-space, 4-space or minified output, and JSON to YAML with 2- or 4-space indentation and no line folding.

Multi-document YAML

Files with several --- documents become a JSON array, and a JSON array can be written out as separate YAML documents.

Anchors and merge keys

Aliases are expanded and << merge keys are applied, so the JSON shows the final values each service actually gets.

Errors with line numbers

Indentation mistakes, duplicate keys, tabs and unclosed quotes are reported with the exact line, column and a code snippet.

Safe, predictable types

YAML 1.2 core rules: yes, no, on and off stay strings, and dates stay as text unless you ask for timestamps.

YAML and JSON side by side

YAML 1.2 is a superset of JSON, so the two map almost one to one. YAML adds comments, anchors and multi-line strings; JSON is stricter and easier for machines.

FeatureYAMLJSON
Objectname: Asha{"name": "Asha"}
Array- a on separate lines, or [a, b]["a", "b"]
Comments# like thisNot allowed — removed when converting
Multi-line text| keeps line breaks, > folds them"line 1\nline 2"
ReuseAnchors &x, aliases *x, merge <<Values are copied in full
Several documentsSeparated by ---One value per file (use an array)

Common YAML mistakes

  • Tabs for indentation. YAML only allows spaces. Replace tabs with two spaces per level.
  • Inconsistent indentation. Every key in the same mapping must start in the same column; one extra space causes “bad indentation of a mapping entry”.
  • Unquoted special characters. Values that start with *, &, @, % or contain : need quotes.
  • The Norway problem. In YAML 1.1 tools, country: NO becomes the boolean false. This converter follows YAML 1.2, where it stays the string “NO”, but quote such values if other tools will read the file.
  • Leading zeros. zip: 01234 is read as the number 1234 in YAML 1.2 core schema — quote it to keep the zero.

YAML ↔ JSON Converter FAQ

How do I convert YAML to JSON?

Paste your YAML into the input with “YAML → JSON” selected. The JSON appears on the right immediately; copy it or download it as a .json file. The YAML to JSON conversion keeps key order and expands anchors and merge keys.

Are YAML comments kept?

No. JSON has no comment syntax, so comments are dropped when converting to JSON, and a JSON → YAML conversion cannot bring them back.

Why did my dates turn into timestamps or stay as text?

By default dates such as 2026-03-15 are kept exactly as written. Tick “Read dates as timestamps” to use YAML’s timestamp type, which converts them to ISO date-times like 2026-03-15T00:00:00.000Z.

Can it convert Kubernetes or Docker Compose files?

Yes. Multi-document Kubernetes manifests become a JSON array of objects, and Compose files with anchors and << merge keys are fully expanded.

Is my configuration sent anywhere?

No. The conversion runs in your browser; only the js-yaml library itself is downloaded from a public CDN. Secrets in your files stay on your device.

Why does JSON → YAML put quotes around some values?

Strings such as yes, on, null or 012 would be read as booleans, null or numbers by some YAML parsers. The converter quotes them so they stay strings in every tool that reads the file.

How do I validate JSON or XML instead?

Use the JSON Formatter for detailed JSON validation and fixes, and the XML Formatter for XML.

You might also need