Skip to content

JSON ↔ YAML Converter

JSON ↔ YAML Converter

Edit JSON and YAML side by side with instant bidirectional sync. Supports indent adjustment, key sorting, and multi-document YAML splitting. Useful for Kubernetes/Helm/CI configs and API debugging.

JSON ↔ YAML Converter

🚀 Quick Start

  • Paste or type JSON in the left editor, and YAML on the right updates automatically.
  • You can also type YAML on the right, and JSON on the left updates automatically.
  • Synchronization is fully bidirectional. No mode switch is needed: edit either side, and the other side updates instantly.
  • Use the top toolbar to set JSON/YAML indentation, enable key sorting, and toggle multi-document YAML output.
  • Press Tab in the editor to insert indentation instead of moving focus.
  • Each editor has Copy and Clear buttons in the top-right corner. Clearing either side clears both sides.

📌 Common Scenarios

  • Kubernetes authoring: convert K8s resource manifests between YAML and JSON to inspect structure from either view.
  • Helm values debugging: convert values.yaml to JSON to inspect types and nesting in your IDE.
  • CI/CD pipelines: quickly convert snippets between GitHub Actions (YAML) and CI systems that use JSON.
  • API debugging: convert JSON payloads to YAML for a clearer hierarchical view.
  • Configuration migration: batch-convert config files between YAML and JSON.
  • Formatting and validation: verify JSON/YAML syntax via two-way sync, with line/column error location.

🧭 Usage Advice

  • A 2-space JSON indent works for most cases; use 4 spaces for deep nesting or Helm values files.
  • Enable Sort keys to output properties in alphabetical order, which helps compare config differences.
  • When the JSON root is an array, enable Multi-document YAML to split each element into a separate document (---), useful for multi-resource K8s files.
  • If input is invalid, the editor shows an error with line/column details; the other side keeps its last valid content.
  • For large content, paste first and wait for sync, then continue editing to avoid excessive re-conversion.

⚠️ Limitations & Compatibility

  • YAML parsing follows the YAML 1.2 spec. Some YAML 1.1-specific behavior (for example, yes/no auto-boolean conversion) may differ.
  • JSON numbers follow JavaScript IEEE 754 limits. Integers beyond 53-bit safe precision may lose accuracy.
  • YAML anchors and aliases (&, *, <<) are expanded to concrete values when converted to JSON; references cannot be preserved.
  • YAML comments are dropped during conversion because JSON does not support comments.

🔒 Privacy & Security

  • All processing happens locally in your browser. Your data never leaves your device.

❓ FAQ

What is the difference between JSON and YAML, and when should I use each?

JSON and YAML can represent the same data types (objects, arrays, strings, numbers), but their syntax differs: • JSON uses braces/brackets and double quotes, has stricter syntax, and does not support comments. • YAML uses indentation for hierarchy, is more human-readable, and supports comments, but is sensitive to whitespace. Rule of thumb: • For APIs and machine-to-machine data exchange, prefer JSON. • For Kubernetes/Helm/CI configs that humans edit often, prefer YAML. • You can convert between them without changing the data model.

Why do yes/no/on/off in YAML become true/false after conversion?

This comes from legacy YAML 1.1 behavior, where yes/no/on/off/y/n may be parsed as booleans. This tool follows YAML 1.2, where only true/false are booleans. If you need string values, quote them (for example, "yes").

Why do YAML comments disappear after converting to JSON?

JSON (RFC 8259) does not allow comments. So YAML comments cannot be preserved in YAML→JSON conversion, and they cannot be reconstructed when converting back. Keep the original YAML file if comments matter.

What does --- mean in YAML?

--- is YAML's document separator, used to store multiple independent documents in one file. This is common in Kubernetes, where one file can contain Deployment, Service, and ConfigMap definitions. This tool reads multi-document YAML as a JSON array, and can also split a JSON array back into --- separated YAML documents.

What should I do if numeric precision is lost after conversion?

JavaScript uses IEEE 754 double-precision numbers. Safe integers range from -(2^53-1) to 2^53-1 (±9007199254740991). Larger integers (for example, Snowflake IDs or 64-bit timestamps) may lose precision. To preserve exact values, store them as strings, such as "9007199254740992".

What happens to YAML anchors (& and *) during conversion?

Anchors (&name) and aliases (*name) are YAML-specific reuse features. JSON has no equivalent reference mechanism, so aliases are expanded into full copies during conversion. This is a lossy transformation, and the original anchor structure cannot be restored automatically.