WebToolsPlanet
converter Tools

YAML to JSON Converter

Convert YAML to JSON and JSON to YAML — for config files, CI pipelines, and Kubernetes manifests.

Last updated: March 25, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is YAML to JSON Converter?

YAML ("YAML Ain't Markup Language") and JSON are both text-based data serialization formats that represent the same underlying data model — maps, sequences, and scalar values. YAML uses human-readable indentation with minimal punctuation, making it the preferred choice for configuration files and developer tooling. JSON uses explicit braces and brackets, making it the preferred choice for APIs and data interchange.

In modern DevOps, you encounter YAML daily: Kubernetes manifests, GitHub Actions workflows, GitLab CI pipelines, Docker Compose files, Ansible playbooks, and Helm charts are all YAML. Being able to convert between YAML and JSON is essential when integrating YAML-configured systems with JSON-based APIs, or when debugging a configuration by converting it to the more explicitly structured JSON format. This tool converts in both directions instantly in your browser.

How to Use YAML to JSON Converter

1

Select the conversion direction: "YAML → JSON" or "JSON → YAML" using the toggle

2

Paste your YAML or JSON into the input panel

3

The converted output appears in real time in the right panel

4

If converting JSON to YAML, set the indentation level (2 or 4 spaces)

5

Click "Copy" to copy the output, or "Download" to save as a file

Common Use Cases

  • Converting GitHub Actions workflow YAML to JSON for automated parsing or validation
  • Transforming Kubernetes manifest files to JSON for use with kubectl --output json
  • Converting Docker Compose YAML to JSON for processing by a custom deployment script
  • Transforming Ansible playbook YAML into JSON for integration with Ansible Tower API
  • Debugging Helm chart values.yaml by converting to JSON for easier structure inspection
  • Converting Swagger/OpenAPI YAML specs (common in API tools like Insomnia) to JSON
  • Transforming a JSON config file to YAML for a cleaner, comment-friendly version
  • Checking if a YAML file parses correctly before using it in a CD pipeline

Example Input and Output

Converting a Kubernetes deployment manifest from YAML to JSON:

YAML input (Kubernetes manifest excerpt)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app
  labels:
    app: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
JSON output
{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "web-app",
    "labels": { "app": "web" }
  },
  "spec": {
    "replicas": 3,
    "selector": {
      "matchLabels": { "app": "web" }
    }
  }
}

Privacy First

All YAML/JSON parsing runs in your browser using js-yaml. Your configuration files — which often contain environment variables, secrets references, and infrastructure details — are never sent to our servers.

Kubernetes Tip

You can use kubectl get deployment web-app -o json to get a live JSON representation of any Kubernetes resource. Converting your static YAML manifest to JSON first helps you compare against the running state and spot drift.

OpenAPI/Swagger Note

Swagger and OpenAPI specs are often maintained in YAML for readability but many tools (like Postman import) require JSON. Convert your openapi.yaml to openapi.json with this tool for cross-tool compatibility. Both formats are fully equivalent and interchangeable.

Frequently Asked Questions

Are YAML comments preserved when converting to JSON?
No — JSON does not support comments as a language feature, so YAML comments (lines starting with #) are dropped during conversion. If you need to preserve documentation, consider using JSON5 or adding comments as string fields (e.g. "_comment": "This sets the replica count").
What is the difference between YAML and JSON in practice?
YAML is more human-writable (no quotes needed for strings, no trailing commas, supports comments), making it ideal for config files developers edit manually. JSON is more machine-parseable (explicit syntax, no ambiguity), making it ideal for API responses and programmatic data. They represent the same data model — the choice is about human vs machine editing.
What YAML features don't have JSON equivalents?
Comments (stripped on conversion), explicit type tags (!!int, !!str, !!binary), multi-line block scalars (| and > literals), and anchors/aliases (& and *). Anchors/aliases are resolved during parsing — the referenced values are inlined into the JSON output. Complex anchors with overrides (<<) are also resolved.
Does this support YAML 1.2 (the modern standard)?
Yes. This tool uses the js-yaml library which supports YAML 1.2 specification, including the stricter boolean handling (only "true"/"false" are booleans; YAML 1.1's "yes"/"no"/"on"/"off" are treated as strings in YAML 1.2). This matters for Kubernetes manifests and modern CI configs.
Can I convert multi-document YAML (files with --- separators)?
Yes. YAML files can contain multiple documents separated by --- (the document start marker). Each document is parsed separately and the output is a JSON array containing all documents in order.
Why does my YAML number look wrong in JSON?
YAML automatically infers types — "42" becomes the integer 42, "3.14" becomes a float, and "0x1A" (hexadecimal) becomes 26. These follow YAML's core schema type inference rules. If you need a number to remain a string, quote it in YAML: "42" (with quotes) stays as the string "42".

How This Tool Works

For YAML → JSON: the input is parsed using js-yaml's safeLoad() function, which builds a JavaScript object model with full YAML 1.2 schema support. The result is serialized to JSON with JSON.stringify(). For JSON → YAML: the JSON is parsed with JSON.parse() and then serialized using js-yaml's dump() function, with indentation and line-width settings applied. Both directions run synchronously in the browser — no server calls are made.

Technical Stack

js-yaml libraryJSON.parse() / JSON.stringify()YAML 1.2 spec compliantClient-side only