webby.tools

JSON to YAML Converter

Paste JSON or YAML into the input box and convert it in one click. The tool detects your input format automatically and outputs the other format. Everything runs in your browser — nothing is sent to any server.

How to Use the JSON to YAML Converter

Paste valid JSON or YAML text into the input box and click Convert. The tool automatically detects whether your input is JSON (starts with { or [) or YAML and converts it to the other format. Use the Swap button to send the output back to the input if you want to convert in the opposite direction.

JSON vs. YAML — What's the Difference?

Both JSON and YAML are data serialization formats widely used for configuration files, API responses, and data exchange. JSON (JavaScript Object Notation) is stricter: it requires quoted keys, uses curly braces and square brackets for structure, and is easy to parse in virtually every programming language. YAML (YAML Ain't Markup Language) uses indentation to represent hierarchy, requires no quotes for most string values, and supports comments — making it more human-readable for configuration files.

YAML is the format of choice for tools like Docker Compose, Kubernetes manifests, GitHub Actions, Ansible playbooks, and many CI/CD pipelines. JSON remains the standard for REST APIs and browser-based data exchange. If you need to tidy up JSON formatting before converting, the JSON formatter can help you pretty-print or minify JSON first.

Common Conversion Rules

  • JSON objects ({}) become YAML mappings (key-value pairs separated by :).
  • JSON arrays ([]) become YAML sequences (each item prefixed with - ).
  • Quoted JSON strings become unquoted YAML strings when safe, or retain quotes when the value contains special characters.
  • JSON booleans and numbers are represented identically in YAML.
  • JSON nulls (null) become ~ or null in YAML.

Note: YAML supports comments (lines beginning with #), but JSON does not. Comments in YAML input are stripped when converting to JSON.

Frequently Asked Questions

Can I convert multi-document YAML?

This converter handles single-document YAML. Multi-document YAML files (separated by ---) are parsed as one document. For complex multi-document files, split them manually before converting.

Are there data types that don't convert cleanly?

YAML supports types that JSON doesn't, such as timestamps, binary data, and aliases/anchors. When converting YAML to JSON, timestamps become strings and anchors/aliases are dereferenced. The reverse direction (JSON to YAML) is generally lossless.

Is my data private?

Yes. All conversion happens locally in your browser using JavaScript. No data is sent to any server. This makes the tool safe to use with private API keys, configuration files, and sensitive application data.

What's the indentation in the YAML output?

The YAML output uses 2-space indentation, which is the most common convention for YAML files used with Kubernetes, Docker Compose, and GitHub Actions. This is not configurable in the current version.

Why does my YAML output have extra quotes around some strings?

The YAML serializer adds quotes around strings that could be misinterpreted as other types — for example, "true", "null", "123", or strings containing special YAML characters like : and #. These quotes are technically correct and required for the YAML to parse correctly.

This website may contain affiliate links. If you click on an affiliate link and make a purchase, we may receive a small commission at no additional cost to you.