๐Ÿ“‘ YAML โ‡„ JSON Converter

YAML Input
JSON Output

This is a lightweight converter supporting a common YAML subset โ€” advanced YAML features are not supported.

Convert between YAML and JSON. Useful when you need to change a config file's format, or just want to see the same data written both ways โ€” including checking a Kubernetes manifest, docker-compose.yml, or CI config.

How to use

  1. Choose the "YAML โ†’ JSON" or "JSON โ†’ YAML" mode.
  2. Paste the YAML or JSON you want to convert into the input box.
  3. Click "Convert" to see the result in the other format.
  4. Click "Copy" to copy the result to your clipboard.

How the calculation works

YAML is a configuration-friendly format that expresses hierarchy through indentation. It represents the same data as JSON โ€” objects, arrays, strings, numbers, booleans and null โ€” so the two convert into each other. "key: value" is an object entry and a leading "- " is an array item. This tool uses its own lightweight parser. Unquoted values are typed as follows: true and false (capitalised too) become booleans; null, ~ and empty become null; anything shaped like an integer or decimal becomes a number; everything else is a string. yes, no, on and off stay as strings. That follows YAML 1.2; in the older YAML 1.1 they were booleans, which famously turned the country code "NO" (Norway) into false. Number detection needs care: a version number such as "1.10" is read as a number and becomes 1.1. Quote any value you need to keep as a string.

Worked example

Converting this YAML name: app version: 1.10 enabled: yes country: NO ports: - 80 - 443 gives {"name": "app", "version": 1.1, "enabled": "yes", "country": "NO", "ports": [80, 443]} Note that version has changed from 1.10 to 1.1. Writing version: "1.10" in quotes keeps it as a string.

Things to be aware of

  • Advanced features such as anchors (&), aliases (*), multiple documents and block scalars (| and >) are not supported.
  • Version numbers such as "1.10" are parsed as numbers. Quote values that must stay strings.
  • YAML comments are lost when converting to JSON.
  • Tabs cannot be used for indentation; use spaces.

FAQ

Can it convert YAML with comments?

When converting YAML to JSON, comments aren't included in the result since JSON itself has no comment syntax.

Can I convert in either direction?

Yes โ€” both YAML โ†’ JSON and JSON โ†’ YAML are supported.

Is this useful for checking a Kubernetes manifest?

Yes โ€” converting a YAML manifest to JSON can make its structure clearer in some cases, though advanced YAML features like anchors aren't supported.

Why does conversion fail?

It fails if the input isn't valid YAML or JSON syntax โ€” check your indentation and quoting.

Is my input sent to a server?

No, conversion happens entirely in your browser and nothing is sent externally.