Skip to content

YAML to JSON Converter

Paste YAML and get the JSON your tools will actually see, with anchors expanded, every digit kept, and a warning wherever YAML 1.1 would read a value differently.

Free · No signupConverted in your browser

Try

Valid YAML · 2 documents · 31 keys · depth 8

JSON58 lines
[
  {
    "apiVersion": "apps/v1",
    "kind": "Deployment",
    "metadata": {
      "name": "web",
      "labels": {
        "app": "web"
      }
    },
    "spec": {
      "replicas": 3,
      "selector": {
        "matchLabels": {
          "app": "web"
        }
      },
      "template": {
        "metadata": {
          "labels": {
            "app": "web"
          }
        },
        "spec": {
          "containers": [
            {
              "name": "web",
              "image": "nginx:1.27",
              "ports": [
                {
                  "containerPort": 80
                }
              ]
            }
          ]
        }
      }
    }
  },
  {
    "apiVersion": "v1",
    "kind": "Service",
    "metadata": {
      "name": "web"
    },
    "spec": {
      "selector": {
        "app": "web"
      },
      "ports": [
        {
          "port": 80,
          "targetPort": 80
        }
      ]
    }
  }
]
  • Aliases (*name) on lines 11, 14 were replaced by the values they point to.

  • 2 documents became one JSON array, in order.

  • Comments were dropped: JSON has no comments.

Converted in this tab as you type. Nothing you paste or upload leaves this page.

Configs live on servers

Ship the config, manage the servers.

CtrlOps opens the servers your YAML deploys to: edit the file in place with the file manager, run the command, and watch the logs, all over your own SSH keys.

Explore File ManagerDownload for MacDownload for Windows

Keep it handy

YAML and JSON,
at a glance.

The same data in two notations. Everything YAML adds on top of JSON is resolved on the way across.

How YAML and JSON compare
FeatureYAMLJSON
CommentsYes ( # ... )No
Multiple documentsYes ( --- separators )No (one root value)
Anchors & referencesYes ( & and * )No
Trailing commasN/ANot allowed
Human readabilityHigh (indentation)Medium (braces)
Machine parsingWidely supportedNative everywhere

How the converter works

Same data.
Nothing guessed.

What this converter does

YAML and JSON describe the same things, maps, lists and values, so any YAML document has a JSON equivalent. The converter parses your YAML with a full YAML parser, keeps keys in the order you wrote them, and writes JSON with the indentation you choose: 2 or 4 spaces, tabs, or minified. Numbers are copied digit for digit, so an ID like 123456789012345678901 is not rounded, and keys such as __proto__ come through as ordinary keys.

YAML 1.2 or YAML 1.1?

The two versions read some unquoted values differently. In YAML 1.2, which most new tools follow, NO and on are text and 0644 is 644. In YAML 1.1, which PyYAML and so Ansible still use, they are false, true and the octal 420, and 22:22 is the base-60 number 1342. Pick the version your tool reads. Either way, every value the other version reads differently is listed with its line, so you can quote it before it bites.

Multi-document files, anchors and merges

A file with several documents separated by ---, such as a Kubernetes manifest, becomes one JSON array in order, or JSON Lines with one document per line for jq. Anchors and aliases are replaced by the values they point to, and << merge keys are applied the way Docker Compose and Ansible apply them: keys written in the map itself win. An alias bomb that would expand to millions of values is stopped instead of freezing the tab.

Tags, comments and what JSON cannot hold

CloudFormation short tags become their JSON form, so !Ref Bucket is {"Ref": "Bucket"} and !GetAtt Bucket.Arn is {"Fn::GetAtt": ["Bucket", "Arn"]}. Other custom tags, such as Home Assistant's !secret, are dropped with a warning that names them. Comments are dropped, and .inf and .nan become null with a warning, because JSON has no way to write them.

Is it safe to paste config here?

Yes. The conversion runs entirely in your browser with no network calls, so it keeps working offline, and nothing you paste, upload or generate leaves the page. It is fine for real manifests, environment files and CI configs.

Going the other way? Convert JSON to YAML

YAML & JSON FAQ

YAML to JSON,
explained.

Keep working

Related tools for your next task.

Your privacy preferences. We use product analytics to improve CtrlOps. Google measurement runs without analytics cookies. Live chat stays off until you allow it. Cookie policy