YAML to JSON Converter Online — Free & Fast

Convert Kubernetes manifests, OpenAPI specs, Helm values, and Ansible variables from YAML to JSON. Resolves anchors and aliases, preserves numbers and booleans, and handles YAML 1.1 vs 1.2 type quirks — 100% in your browser.

What is a YAML to JSON Converter?

A YAML to JSON converter reads a YAML document and emits the equivalent JSON. The two formats represent the same underlying data model — mappings, sequences, and scalars — but JSON is stricter, has no comments, and is the native interchange format for HTTP APIs, browsers, and most modern programming languages. Converting YAML to JSON is essential whenever a config, manifest, or data file written in YAML must be consumed by a system that only speaks JSON.

YAML's rich type system — booleans, integers, floats, null, dates, and the infamous Norway problem — makes the conversion non-trivial. The OpenFormatter YAML to JSON converter resolves anchors and aliases, preserves numeric and boolean types correctly, strips comments (JSON has none), and runs entirely in your browser so manifests with secrets never leave your machine.

How to convert YAML to JSON online — 4 steps

  1. Paste your YAML. Copy a Kubernetes manifest, OpenAPI spec, Helm values.yaml, Ansible variable file, or any .yaml source into the YAML Input panel above. Click Load Sample to try a Kubernetes Deployment.
  2. Click Convert. The converter parses the YAML client-side, resolves anchors and aliases, and emits the equivalent JSON.
  3. Verify types. Confirm booleans, numbers, and nested structures match the source. Quoted YAML scalars become JSON strings; unquoted numerics become JSON numbers.
  4. Copy the JSON. Click Copy to grab the result for an API request body, a config consumer, a JSON-native datastore, or a JavaScript application.

Sample YAML and JSON output

Watch how the converter handles types, anchors, and nested structures:

YAML input

# k8s deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    tier: frontend
spec:
  replicas: 3
  enabled: true
  version: "1.25"
  ports:
    - 80
    - 443

JSON output

{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "web",
    "labels": { "tier": "frontend" }
  },
  "spec": {
    "replicas": 3,
    "enabled": true,
    "version": "1.25",
    "ports": [80, 443]
  }
}

Notice that replicas: 3 stays a number, enabled: true stays a boolean, but version: "1.25" is preserved as a string because of the quotes — a critical detail when JSON consumers expect a semver string, not a float.

Type-Faithful Conversion

Booleans, integers, floats, null, and quoted strings are mapped to the matching JSON scalar types — no silent coercion of "1.25" to a number.

Anchors & Aliases Resolved

YAML anchors (&) and aliases (*) are inlined into the JSON output because JSON has no reference syntax. Repeated values are duplicated cleanly.

Client-Side Only

YAML is parsed in JavaScript inside your browser. Manifests with secrets, database URLs, or proprietary config never leave the device.

Common use cases

  • check_circleSubmitting Kubernetes manifests directly to the API server, which accepts JSON natively
  • check_circleConverting OpenAPI / Swagger specs from YAML to JSON for tooling that requires JSON
  • check_circleFeeding Helm chart values.yaml into a JSON-only pipeline or admission controller
  • check_circleTranslating Ansible variable files for integration tests written in JavaScript or Go
  • check_circleStoring YAML config in Firestore, DynamoDB, or another JSON-native document store
  • check_circleBridging YAML-based infrastructure-as-code into JSON-only API clients
  • check_circleEmbedding YAML samples into JSON test fixtures and snapshots
  • check_circleConverting GitHub Actions workflows to JSON for analysis or migration tooling

YAML 1.1 vs 1.2 — why types matter

The biggest source of bugs converting YAML to JSON is the difference between YAML 1.1 and 1.2 boolean handling. YAML 1.1 (still used by PyYAML default, older Ansible, and many k8s tools) treats yes, no, on, off, y, and n as booleans — which is why the country code NO for Norway becomes false in JSON. YAML 1.2 (used by go-yaml v3 and modern parsers) only treats true and false as booleans. When in doubt, quote the value: country: "NO" always becomes "country": "NO". The same applies to leading-zero integers (012 is octal in YAML 1.1) and Sexagesimal numbers (3:25 was a number in YAML 1.1, now a string).

Need to convert in the other direction?

Convert JSON back to YAML, change format to XML or CSV, or validate the YAML before converting — all browser-side.

Frequently Asked Questions

Why does YAML "yes" become true in JSON?

YAML 1.1 treats unquoted yes, no, on, off, y, and n as booleans, so they convert to true or false in JSON. This is the famous Norway problem — the country code "NO" parsed as false. To keep them as strings in your JSON output, quote the YAML values: "yes", "no", "NO". YAML 1.2 only recognizes true and false as booleans, but many tools still default to 1.1 semantics.

How are YAML anchors and aliases handled?

YAML anchors (&name) and aliases (*name) are resolved before serialization. The referenced value is inlined into the JSON output everywhere the alias appears, because JSON has no native reference syntax. If you need to preserve sharing semantics in the JSON consumer, you must implement that at the application layer.

What about YAML date and timestamp types?

YAML 1.1 supports a native !!timestamp tag (ISO 8601 dates). JSON has no date type, so timestamps are emitted as ISO 8601 strings. Code consuming the JSON must parse the string back into a Date if needed.

Are YAML comments preserved in JSON?

No. JSON has no comment syntax, so YAML comments (lines beginning with #) are stripped during conversion. Only data values and structure are emitted. If you need annotations in the JSON, embed them as data fields like "_comment": "..." instead.

Will multi-line YAML strings convert correctly?

Yes. YAML block scalars using the | (literal) and > (folded) operators are converted to JSON strings with the appropriate newline behaviour: literal blocks keep all line breaks, folded blocks join lines with spaces. The result is a single quoted JSON string with embedded \n where required.

Can it convert multi-document YAML files separated by ---?

Multi-document YAML (separated by ---) is converted to a JSON array, one element per YAML document, in source order. Most JSON consumers prefer a single root object, so for Kubernetes manifests it is common to either pick a single document or wrap the array in a parent key.

Is my YAML uploaded to your servers?

No. Conversion runs entirely in your browser using JavaScript. Files containing Kubernetes secrets, database URLs, OAuth client IDs, or proprietary infrastructure configuration never leave your device. You can verify in DevTools → Network: no request fires when you click Convert.

How are numbers preserved when converting YAML to JSON?

Unquoted numeric YAML scalars (1, 1.5, 1e10, 0xFF, 0o77) are parsed as JSON numbers. Quoted versions ("1", "1.5") stay strings. Be careful with leading zeros in YAML 1.1 — "012" parses as octal 10, while in YAML 1.2 it stays the integer 12. Quote anything where the literal text matters (phone numbers, ZIP codes, version strings).

YAML to JSON Converter Online — Free & Fast | OpenFormatter