🔀

YAML JSON Converter

Convert between YAML and JSON, handling indentation, lists and scalar types
YAML 📂 Text 👤 ToolWorld 🏷️ v1.2.2
Loading...
Input Paste or type text; it is processed locally
Content
Settings Choose how to process
Direction

Everything runs in the browser; your text is never uploaded

Enter text and press process. Everything runs locally; nothing is uploaded

Result Copy the result in one click

How to Use

📖 Tool Introduction


Convert configuration between YAML and JSON, handling indentation, lists and scalar types automatically.

The relationship between the two is straightforward. YAML is meant to be read by people and expresses nesting through indentation, while JSON is meant to be read by programs and expresses it through brackets and commas. Kubernetes manifests, continuous integration pipelines and most service configuration are written in YAML, but the moment that configuration has to go into a program or be posted to an interface it generally has to be JSON first.

Going to YAML, scalars are handled properly: bare numbers and booleans are written without quotes, while a string containing a colon, a hash, brackets or anything else that could break the structure is quoted automatically. Without that care the output would be YAML that no parser accepts, which is a worse outcome than not converting at all. Empty objects and arrays stay in their compact form rather than becoming an empty block.

Going to JSON covers the part of YAML that configuration files are actually made of: two space indentation, keys separated from values by a colon, dashes for lists, and a hash for comments. Scalars are typed on the way through, so a port number comes out as a number and the word true comes out as a boolean rather than as a string that merely looks like one.

One boundary is worth stating plainly, because guessing here would be worse than refusing. Anchors, aliases and the inline flow style are outside what this supports. When they turn up the tool reports that it could not parse the input rather than producing something plausible that happens to be wrong, since a wrong config file is the kind of thing that is discovered at the worst possible moment.

Everything runs in the browser, so what you paste never leaves your device.

Indentation is the usual cause of a failure to parse, and it is worth knowing why before assuming the tool is at fault. YAML infers structure from how far a line is indented, so a file that mixes tabs and spaces, or that shifts a single key by one column, describes a structure that is not the one you can see. Most editors can show invisible characters, and turning that on resolves these quickly. The same applies to a value that begins with a special character and was never quoted, which is the other recurring cause and is fixed at the source rather than here.

✨ Key Features


  • Both directions between JSON and YAML
  • Scalar types recognised: numbers, booleans, nulls and strings
  • Strings that need quoting are quoted, so the output actually parses
  • Nested structures and lists supported, with correct indentation
  • Comment lines are skipped
  • Runs locally: nothing is uploaded

🚀 How to Use


  1. Paste YAML or JSON on the left
  2. Pick the direction on the right
  3. Press process, or use Ctrl plus Enter
  4. The result box shows the output and the change in size
  5. Copy result puts it on your clipboard

⚠️ Things to Note


  • Data source: Based on the YAML and JSON specifications; conversion runs in the browser
  • A useful subset: Covers two space indentation, keys, lists and comments, which is what configuration files use
  • Anchors and aliases are out of scope: Those, along with the inline flow style, are reported as unparseable rather than converted wrongly
  • Keep indentation consistent: Mixing indentation widths within one level causes parsing to fail
  • Privacy: Everything runs in the browser. What you paste is never sent to a server

Related

⏫︎