YAML to JSON Converter

Convert YAML to JSON
online, free & instant

Paste your YAML configuration and get valid, properly formatted JSON output in one click. Handles indentation, anchors, and multi-document YAML — all in your browser.

Open YAML to JSON Converter

Valid JSON from YAML in three steps

Paste your YAML Drop any valid YAML — config files, Kubernetes manifests, CI/CD pipelines, or API specs — into the input.
Instant JSON output The converter parses YAML indentation, maps, sequences, and scalars into clean, valid JSON immediately.
Anchors & merge keys resolved YAML anchors (&), aliases (*), and merge keys (<<) are fully expanded in the resulting JSON.
Copy or download One-click copy puts the JSON on your clipboard, or download as a .json file for your project.

No account. No upload. No nonsense.

🔒

No Server

Your YAML never leaves your device. There is no backend to send it to.

Zero Dependencies

Single self-contained HTML file. No frameworks, no CDN calls, nothing to break.

📡

Works Offline

Load once and use forever — even on a plane or without internet access.

Related JSON tools

JSON to YAML Convert JSON back to YAML — the reverse direction, equally instant.
JSON Formatter Pretty-print JSON with syntax highlighting and a collapsible tree view.
JSON Validator Check if your JSON is valid and get clear error messages with line numbers.
JSON to CSV Convert JSON arrays to CSV for spreadsheets and data analysis.

Common questions answered

How do I convert YAML to JSON online?

Paste your YAML into the input, switch to the Convert tab, and the tool instantly produces valid JSON. No signup or server upload required.

What are the syntax differences between YAML and JSON?

YAML uses indentation instead of braces and brackets, supports comments with #, allows unquoted strings, and has features like anchors and aliases. JSON is stricter — keys must be double-quoted, no comments, no trailing commas.

Does the converter handle YAML anchors and aliases?

The converter processes standard YAML features including anchors (&), aliases (*), and merge keys (<<). These are resolved and expanded in the JSON output.

Can I convert multi-document YAML to JSON?

Yes, multi-document YAML files separated by --- are supported. Each document is converted to a separate JSON object in an array.

Is my YAML data secure during conversion?

Absolutely. All conversion happens in your browser — no data is ever sent to a server. The tool works offline too.

Converting YAML to JSON

YAML to JSON conversion is common when processing YAML configuration files programmatically or sending them to JSON-only APIs. Kubernetes manifests, Docker Compose files, and CI/CD pipelines use YAML, but the tools that validate or apply these configurations often work with JSON internally.

YAML is a superset of JSON, so any JSON is valid YAML. Going the other direction requires handling YAML-specific features: comments are stripped (JSON has none), anchors and aliases are resolved, multi-line strings are joined, and implicit type coercion (yes → true, 1.0 → number) is applied. This tool parses YAML safely and produces strict JSON.

Convert YAML to JSON
Input
# App configuration
name: my-app
version: 1.0.0
database:
  host: localhost
  port: 5432
features:
  - auth
  - logging
Output
{
  "name": "my-app",
  "version": "1.0.0",
  "database": {
    "host": "localhost",
    "port": 5432
  },
  "features": [
    "auth",
    "logging"
  ]
}

Get the most out of this tool

Ready to convert your YAML?

Free forever. No signup. Instant results.

Convert YAML to JSON now

How YAML-to-JSON conversion works

YAML (YAML Ain't Markup Language) is a human-readable data serialization format designed as a superset of JSON. This superset relationship means every valid JSON document is valid YAML, but YAML supports additional features that JSON does not: comments, multi-line strings, anchors and aliases for reuse, custom tags, and multiple documents in one file separated by ---. Converting YAML to JSON discards these extra features, producing a JSON representation of the underlying data structure.

YAML uses indentation to denote structure rather than braces and brackets. A mapping (equivalent to a JSON object) uses key: value pairs on successive lines with consistent indentation. A sequence (equivalent to a JSON array) uses items prefixed with a dash (- item). The conversion process parses this indentation-based structure and emits the corresponding JSON syntax with explicit {} and [] delimiters.

YAML 1.1's boolean type coercion is a notorious source of bugs when converting to JSON. In YAML 1.1, the values yes, no, on, off, true, and false are all treated as boolean values. This causes problems with country codes like NO (Norway) or configuration values like on being silently converted to true. YAML 1.2 (adopted by most modern parsers) restricts boolean coercion to only true and false, eliminating this ambiguity.

YAML anchors (&anchor-name) and aliases (*anchor-name) provide a reuse mechanism: define a value once, reference it multiple times. When converting to JSON, aliases are expanded inline — each reference becomes a full copy of the anchored value. This expansion can significantly increase JSON file size if anchors are used for large repeated structures, but JSON has no equivalent reuse mechanism.

Multi-document YAML files (multiple documents separated by ---) present a choice during JSON conversion: produce a JSON array containing each document as an element, or require the user to select which document to convert. This is relevant for Kubernetes manifests, which commonly use multi-document YAML files containing multiple resource definitions (Deployment, Service, ConfigMap) separated by ---.

YAML comments (lines starting with #) carry important human-readable context — explaining why a value is set, marking deprecated fields, or providing examples. JSON has no comment syntax, so all YAML comments are discarded during conversion. If your YAML contains important comments that need to be preserved, consider including that information in dedicated description or documentation fields before converting.

When converting Kubernetes or Helm chart YAML to JSON, the result is useful for programmatic inspection and manipulation — for example, using jq to extract specific values, or feeding the configuration into JSON Schema validators. The converted JSON can also be used as input to this tool's JSONPath evaluator to query specific fields from complex multi-resource manifests.

When developers convert YAML to JSON

Processing Kubernetes manifests programmatically Kubernetes resources are defined in YAML but the Kubernetes API accepts JSON. Converting YAML manifests to JSON enables programmatic inspection with jq, JSON Schema validation, and feeding configurations to tools that only accept JSON input.
Feeding YAML configs to JSON-only APIs Many REST APIs accept JSON payloads exclusively. When your configuration or data lives in YAML files — common in infrastructure-as-code setups — converting to JSON before sending to the API bridges the format gap without manual reformatting.
Debugging OpenAPI and AsyncAPI specs API specifications written in YAML sometimes produce unexpected behavior in OpenAPI tooling. Converting to JSON and validating against the JSON Schema for OpenAPI helps isolate whether issues are YAML parsing artifacts or genuine specification errors.
Migrating from YAML-based configs to JSON Projects switching from YAML configuration files (common in Ruby and Python ecosystems) to JSON configuration (common in Node.js projects) need bulk conversion. YAML-to-JSON conversion provides the starting point for this migration.

YAML-to-JSON conversion gotchas
  • YAML 1.1 boolean coercion surprises: Country codes (NO, YES), toggle values (on, off), and other short strings may be silently converted to JSON booleans by YAML 1.1 parsers. Always quote these values in your YAML ("NO", "on") to ensure they remain strings in the JSON output.
  • Losing YAML comments: JSON has no comment syntax, so all # comments in your YAML are dropped during conversion. If comments document important decisions or environment-specific values, extract that information into separate documentation before converting.
  • Octal number interpretation: YAML 1.1 interprets numbers starting with 0 as octal — so 0777 becomes the integer 511 in the JSON output. Use YAML 1.2-compliant parsers or quote the value as a string to preserve the literal representation.
  • Multi-document YAML losing documents: If your YAML file contains multiple --- separated documents and the converter only processes the first, subsequent documents are silently dropped. Verify that your converter handles multi-document YAML or split the file before converting.
  • Anchor expansion causing large JSON: YAML anchors reference a single definition multiple times. JSON has no anchors — each reference is fully expanded. A large anchored value referenced 20 times in YAML becomes 20 full copies in JSON, potentially increasing file size dramatically.

Additional frequently asked questions

Does YAML-to-JSON conversion preserve the data types from YAML?

YAML supports integers, floats, booleans, null, and strings — all of which map to JSON equivalents. YAML-specific types like timestamps, binary, and merge keys (<<) have no JSON equivalent and are typically converted to strings or expanded inline. The JSON output preserves numeric, boolean, and null types from YAML correctly.

Can I convert a YAML file with multiple documents separated by ---?

Yes — multi-document YAML files contain multiple complete YAML documents separated by --- dividers. A converter can produce a JSON array where each element is one document, or it may only process the first document. Check your converter's behavior and select which document to convert if needed.

Why does my YAML number convert to the wrong value in JSON?

YAML 1.1 parsers interpret numbers starting with 0 as octal and numbers starting with 0x as hexadecimal. This means YAML 0644 becomes JSON 420. Quote numeric values that should be preserved as strings, or use a YAML 1.2-compliant parser that does not apply these implicit conversions.

Is YAML always a superset of JSON?

YAML 1.2 is designed to be a strict superset of JSON, meaning every valid JSON file is also valid YAML 1.2. YAML 1.1 has some incompatibilities with JSON — for example, in YAML 1.1 duplicate keys are allowed (last value wins), while JSON technically disallows duplicate keys. Most modern YAML parsers implement YAML 1.2 to maintain JSON compatibility.