JSON ↔ YAML Converter

Convert JSON to YAML and YAML to JSON with auto-detection, syntax highlighting, and format indicators.

JSON ↔ YAML Converter

Convert between JSON and YAML formats with syntax highlighting

1 lines · 0 characters

Conversion Options

JSON to YAML and YAML to JSON Converter

JSON and YAML represent the same data structures but with different syntax. JSON is the standard format for web APIs and JavaScript configs. YAML is preferred in DevOps tools like Kubernetes, Docker Compose, GitHub Actions, and Ansible because its clean indentation-based syntax is easier to read and edit by hand.

This free JSON to YAML converter automatically detects which format you paste and converts in either direction with one click. No manual format selection needed.

How to convert JSON to YAML

  1. Paste your JSON or YAML into the input panel.
  2. The tool detects the format automatically and shows a format badge.
  3. Click Convert to produce the output in the other format.
  4. Copy the converted result to clipboard with one click.

JSON vs YAML: key differences

  • Syntax: JSON uses braces and quotes. YAML uses indentation and is more readable for humans.
  • Comments: YAML supports comments (#). JSON does not.
  • Data types: YAML auto-infers types (strings, numbers, booleans) without quotes. JSON requires explicit quoting of strings.
  • Multiline strings: YAML has built-in block scalar syntax (| and >). JSON requires escaped sequences.

Common DevOps use cases

  • Kubernetes: Convert a JSON API response or Helm values file to a YAML manifest.
  • Docker Compose: Migrate service definitions between JSON and YAML formats.
  • GitHub Actions: Build workflow YAML from JSON configuration data.
  • Ansible: Convert inventory or variable files between JSON and YAML.
  • OpenAPI / Swagger: Switch API spec files between JSON and YAML for different tooling requirements.

Frequently Asked Questions

How do I convert JSON to YAML online?

Paste the JSON in the input, choose the YAML direction and the result appears immediately. Keys, nested objects and arrays are kept in order and strings that would be misread by YAML, such as yes, no or 007, are quoted automatically. Everything runs in the browser.

Is YAML a superset of JSON?

Almost: every JSON document is valid YAML 1.2, which is why JSON can always be converted to YAML. The reverse is not always true, YAML adds comments, anchors, multi-line strings and several boolean spellings, and comments are dropped when converting YAML to JSON because JSON has no way to represent them.

Why did my YAML value change type after conversion?

YAML 1.1 parsers treat unquoted values like yes, no, on, off or 1_000 as booleans and numbers. The converter follows YAML 1.2 core rules, so only true and false are booleans, and it quotes such strings on output to keep the original text. Quote a value yourself in the YAML source to force a string.

Can I convert Kubernetes or Docker Compose files?

Yes, multi-document YAML files separated by --- are supported and each document becomes an entry of a JSON array. Anchors and merge keys are resolved during the conversion so the JSON shows the expanded values.

Free forever, no ads, no tracking. Support the project