YAML JSON Converter

Convert YAML configuration files to JSON and vice versa.

About YAML / JSON conversion

YAML and JSON describe the same kinds of data — objects, arrays, strings, numbers, booleans and nulls — but with very different surface syntax. JSON is strict and verbose; YAML is forgiving and human-friendly, with significant whitespace, comments, and anchors. Most modern infrastructure config (Kubernetes manifests, GitHub Actions workflows, Docker Compose files) is written in YAML, while most web APIs speak JSON. Converting between them is one of the most common tasks for SREs and platform engineers.

This converter round-trips between YAML and JSON, preserves comments where the destination format allows, and handles multi-document YAML files (those separated by---). All conversion is performed locally.

How to use

  1. Pick the direction: YAML → JSON or JSON → YAML.
  2. Paste your input. Errors include the line number where the parser failed.
  3. Adjust indentation (2 or 4 spaces) and quoting style for the YAML output.
  4. Copy the result.

Common use cases

  • Translating a JSON config file into a Kubernetes-friendly YAML manifest.
  • Pasting a GitHub Actions workflow into a JSON-based linter.
  • Comparing two pieces of infrastructure config in a single format before diffing.
  • Authoring API request bodies in YAML for readability, then converting to JSON for the curl command.

Frequently asked questions

Are YAML comments preserved?

Comments are kept when the destination is YAML; JSON has no comment syntax so they are discarded going JSON → YAML → JSON.

How does it handle YAML anchors and aliases?

Anchors are expanded so the resulting JSON has no shared references. Round-tripping back to YAML produces the expanded form, not the original anchors.

What about multi-document YAML?

Documents separated by --- become an array of objects in the JSON output.

Advertisement