JSON to YAML Converter Online — Free Online Tool

Produce clean, 2-space indented block-style YAML from any JSON document — ideal for Kubernetes manifests, Docker Compose, Helm values, and CI/CD pipelines.

What is a JSON to YAML converter?

A JSON to YAML converter rewrites a JSON document in YAML's indentation-based block style, which is easier to read, easier to diff in pull requests, and required by the DevOps tooling ecosystem — Kubernetes, Docker Compose, Helm, GitHub Actions, GitLab CI, Ansible, and Argo all consume YAML natively. The result is the same data with friendlier syntax.

OpenFormatter's converter preserves key order from your source JSON (so apiVersion appears before kind as Kubernetes convention dictates), uses 2-space indentation (the ecosystem standard), and auto-quotes any string containing YAML reserved characters or that would otherwise parse as a different type (like the famous yestrue Norway problem).

How to convert JSON to YAML online — 4 steps

  1. Paste your JSON. Copy a Kubernetes config, Helm values document, GitHub Actions workflow JSON, or any valid JSON into the Input panel.
  2. Click Convert. The tool parses your JSON in the browser and emits 2-space indented, block-style YAML 1.2.
  3. Review the output. Mappings use key: value, sequences use - dashes, and strings containing reserved chars are auto-quoted to preserve their meaning.
  4. Drop into your manifest. Click Copy and paste into your deployment.yaml, docker-compose.yaml, or values.yaml.

Sample JSON and YAML output

Input JSON

{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": {
    "name": "web-service",
    "namespace": "default"
  },
  "spec": {
    "selector": { "app": "web" },
    "ports": [
      { "name": "http", "port": 80, "targetPort": 8080 },
      { "name": "https", "port": 443, "targetPort": 8443 }
    ]
  }
}

Output YAML

apiVersion: v1
kind: Service
metadata:
  name: web-service
  namespace: default
spec:
  selector:
    app: web
  ports:
    -
      name: http
      port: 80
      targetPort: 8080
    -
      name: https
      port: 443
      targetPort: 8443

Block-Style Output

Multi-line, indentation-based YAML — the form humans want to read and that diffs cleanly in pull requests. No compact flow style for nested structures.

Key Order Preserved

Insertion order from your source JSON is preserved in the YAML output, keeping conventional Kubernetes ordering (apiVersion, kind, metadata, spec) intact.

Client-Side Only

Conversion runs in your browser. Manifests with secrets, Helm values with database URLs, or proprietary configs never leave your device.

Common use cases

  • check_circleConverting JSON Kubernetes manifests (from kubectl get -o json) into YAML for kubectl apply or GitOps pipelines
  • check_circleTranslating Helm values JSON to values.yaml for chart installation and upgrade
  • check_circleProducing Docker Compose YAML from JSON config generated by orchestration tools
  • check_circleRewriting OpenAPI / Swagger JSON specs as YAML for human-readable API documentation
  • check_circleConverting Terraform JSON output to YAML for Argo CD, Flux, or other GitOps controllers
  • check_circleGenerating GitHub Actions, GitLab CI, or CircleCI workflow YAML from JSON pipeline definitions
  • check_circleMigrating Ansible inventory or vars from JSON to YAML for playbook compatibility
  • check_circleProducing Prometheus, Grafana, and Loki configs in YAML from JSON-based config builders

YAML vs JSON: when to convert?

JSON is the better wire format — strict, parseable everywhere, and trivially produced by code. YAML is the better human format — diffable, comment-friendly, and the default for the entire DevOps ecosystem. Convert JSON to YAML when configs need to be reviewed, edited, or stored in a Git repo. Keep JSON when configs are generated and consumed by code paths only. Round-trip safety is preserved as long as you stick to YAML 1.2 (the modern standard) — earlier YAML 1.1 had quirks like yes parsing as boolean true, which the converter avoids by auto-quoting risky strings.

Need to validate or round-trip the YAML?

Validate, format, or convert YAML back to JSON — all in your browser.

Frequently Asked Questions

Will the converter use block or flow YAML style?

Block style — the multi-line, indentation-based form used by Kubernetes manifests, Docker Compose, and Helm. This is what humans want to read and review. Flow style — the inline {key: value} JSON-like form — is more compact but harder to diff in pull requests, so this tool never emits it for nested structures (only empty {} and [] for empty containers).

How are JSON nulls represented in YAML?

JSON null becomes the literal text null in YAML, which the YAML 1.2 spec accepts as a null scalar. Other valid YAML null forms exist (~, an empty value after a colon, the literal Null or NULL) but consistency matters more than which form. Stick with null for round-trip safety.

Are the JSON keys re-ordered alphabetically?

No. The converter preserves insertion order — the order keys appear in your source JSON is the order they appear in the YAML output. This matters for Kubernetes manifests and Helm charts where conventional ordering (apiVersion, kind, metadata, spec) signals intent to reviewers and is preserved by tools like kustomize.

How is the indent width chosen?

The output uses 2-space indentation, which is the convention for Kubernetes, Docker Compose, GitHub Actions, and Ansible. YAML technically allows any consistent width, but 2 spaces is what the ecosystem expects and what kubectl, helm, and yamllint emit by default. Mixing or using larger widths is valid YAML but unusual.

Why is one of my string values quoted in the YAML output?

Strings that contain YAML reserved characters (: # [ ] { } & * ! | > ' " % @ `), embedded newlines, or are empty must be quoted to avoid being parsed as something else. A bare value like 1.0 would parse as a float, "yes" as a boolean (in YAML 1.1), and "10:30" as a sexagesimal number. Quoting them preserves the original string semantics.

Can I drop the YAML straight into a Kubernetes manifest?

Yes — the output is YAML 1.2 compliant and parses cleanly with kubectl apply, helm template, kustomize build, and yq. For Kubernetes specifically, the source JSON must already have the correct shape (apiVersion, kind, metadata, spec). The converter does not invent or validate Kubernetes schema fields; it just translates JSON to YAML faithfully.

Does the YAML output support comments?

No — JSON has no comment syntax, so the source has nothing to carry. Add comments manually to the YAML output after conversion. If you need comment-preserving round-trips, work in YAML throughout and use a comment-aware library like ruamel.yaml on the Python side.

Is my JSON sent to a server?

No. Conversion runs entirely in your browser using JavaScript. JSON containing Kubernetes secrets, Helm values with database URLs, or proprietary configuration never leaves your device. Open DevTools Network tab and verify — no request fires when you click Convert.

JSON to YAML Converter Online — Free Online Tool