OnlyFormat

JSON to YAML Converter

Convert JSON data to YAML format instantly. Paste text or upload a .json file.

No data sent to server
JSON Input
YAML Output

Related Tools

What is JSON to YAML?

JSON dominates web APIs (compact, fast to parse). YAML dominates configuration files (readable, supports comments). Converting JSON → YAML is common when migrating API responses to config files or when you need to hand-edit machine-generated data.

Common scenarios: Kubernetes manifests (when a tool outputs JSON, convert for readability), Docker Compose migration, GitHub Actions / GitLab CI workflow drafts, OpenAPI specs (Swagger UI exports JSON, but humans prefer YAML), Helm values files, Ansible playbooks from automation tools.

Conversion example

# JSON
{
  "name": "myapp",
  "version": "1.0.0",
  "ports": [80, 443],
  "env": { "DEBUG": false, "PORT": 3000 }
}

# YAML
name: myapp
version: 1.0.0
ports:
  - 80
  - 443
env:
  DEBUG: false
  PORT: 3000

JSON vs YAML — when each wins

  • JSON: APIs (compact, fast parse), inter-service messaging, browser fetch responses, log lines
  • YAML: configs (readable, comments allowed), Kubernetes/Docker, CI/CD, infrastructure-as-code, data with anchors/aliases for DRY

Trade-off: YAML parses 5–10× slower than JSON and has type-coercion quirks (the famous "Norway problem" — country code NO becomes false). Choose JSON for runtime, YAML for config.

YAML pitfalls to know

  • The Norway problem: NO, yes, off, on coerce to booleans in YAML 1.1 — quote them as strings if needed
  • Octal numbers: 0644 → 420 decimal in YAML 1.1 (file permissions trap)
  • Indentation: spaces only — never tabs. Inconsistent indent breaks parsing
  • Strings vs numbers: version: 1.0 is a number; quote as "1.0" if you mean the string
  • Anchors / aliases: not supported in JSON; this conversion direction (JSON→YAML) won't lose anything

How to Use

  1. Paste JSON data, or upload a .json file.
  2. Click Convert.
  3. Review the YAML — verify indentation and types.
  4. Copy or download as .yaml / .yml.

Privacy: Conversion runs in your browser.

FAQ

Is the YAML output valid for Kubernetes?

Yes — output follows YAML 1.2 syntax compatible with Kubernetes (kubectl), Docker Compose, GitHub Actions, GitLab CI, Ansible. Add a leading --- for multi-document YAML if combining manifests.

How are null values handled?

JSON null becomes YAML null (or empty value). Both are valid representations.

Can I add comments to the YAML?

Comments are added after conversion — the conversion can't infer where comments should go. Edit the YAML to add # comments where helpful.

What's the file extension — .yaml or .yml?

Both work. .yaml is the official spec recommendation; .yml exists for historical reasons. GitHub recognizes both. Pick one for project consistency.

Why does my YAML output look slightly different from what I expected?

YAML has multiple equivalent forms — flow vs block, quoted vs unquoted, etc. The output uses block style (most readable). For exact format control, use a parser library with custom emitter options (e.g., js-yaml).

⚠️ Reference Only

Output is generated based on your input and is provided for reference. Results may vary depending on your specific use case, edge cases, or environment-specific behavior. We do not guarantee accuracy of conversions, validations, or computed values.

Always verify critical outputs against official documentation or production environments. We are not responsible for any decisions or losses based on these tool results.