Skip to main content

Free YAML / JSON Converter

Convert YAML to JSON and back|
4.8 (1,689)

Paste YAML and get JSON, or paste JSON and get YAML. Powered by js-yaml, the most popular JavaScript YAML parser with tens of thousands of dependent packages on npm. Implements the YAML 1.2 specification — the version that fixed the infamous Norway problem and made YAML a strict superset of JSON. Handles nested objects, arrays, multiline strings (literal and folded block scalars), anchors, aliases, and all standard YAML features. Ideal for converting Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, Helm charts, and any other YAML or JSON configuration. Runs locally in your browser — no data sent anywhere.

Engine:js-yaml

Need expert help with AI?

Looking for a specialist to help integrate, optimize, or consult on AI systems? Book a one-on-one technical consultation with an experienced AI consultant to get tailored advice.

Why Convert Between YAML and JSON?

YAML and JSON are the two most common configuration and data serialization formats in modern software development. YAML is the dominant format for human-written configuration — Kubernetes manifests, Docker Compose service definitions, GitHub Actions workflows, GitLab CI pipelines, Ansible playbooks, Helm chart values, and Terraform variable files are all written in YAML. JSON is the universal format for APIs, programmatic data exchange, and tool interoperability — REST APIs consume and produce JSON, package.json and tsconfig.json configure JavaScript tooling, and most programming languages have built-in JSON parsers. Converting between the two formats is a daily task for developers and DevOps engineers.

The two formats represent identical data structures — maps, sequences, strings, numbers, booleans, and null — so conversion between them is lossless for data. The main difference is syntax: YAML uses indentation and minimal punctuation for readability, while JSON uses braces, brackets, and quotes for strict, unambiguous parsing. YAML also supports features that JSON lacks — comments, multiline strings with literal (|) and folded (>) block scalars, anchors and aliases for content reuse, and a cleaner syntax for nested data. When converting YAML to JSON, comments are lost and anchors are expanded into their full form, but all data values are preserved exactly.

This tool uses js-yaml, the most widely used JavaScript YAML parser, which implements the YAML 1.2 specification. YAML 1.2 was a significant update that made YAML a strict superset of JSON (every valid JSON document is valid YAML 1.2), fixed the infamous Norway problem where country codes like "NO" were silently parsed as boolean false, and tightened the rules for implicit type detection. The conversion is instant and runs entirely in your browser — no data is sent to any server.

YAML Gotchas Every Developer Should Know

YAML is designed for human readability, but its implicit type system can cause subtle and hard-to-debug issues. The most famous example is the Norway problem: in YAML 1.1, the two-letter country code "NO" for Norway was silently interpreted as the boolean value false because no, No, NO, yes, on, off, y, and n were all recognized as boolean literals. This caused real production bugs in internationalization systems, data pipelines, and infrastructure configurations. YAML 1.2 fixed this by restricting booleans to only true, True, TRUE, false, False, and FALSE. This tool uses js-yaml which implements YAML 1.2, so the Norway problem does not apply here — but you should be aware of it when working with older YAML parsers like PyYAML (Python) which still defaults to YAML 1.1 behavior.

Other common YAML pitfalls include: version numbers like 3.10 being parsed as the floating-point number 3.1 (losing the trailing zero), strings like "null" or "Null" being parsed as null values, octal number confusion (010 was octal 8 in YAML 1.1 but is decimal 10 in YAML 1.2), and indentation errors that silently change the data structure rather than producing an error. Tabs are not allowed for indentation in YAML — only spaces — and inconsistent indentation levels will either fail to parse or produce unexpected nesting. The defensive best practice is to always quote values that are meant to be strings, especially if they could be mistaken for booleans, numbers, or null.

Converting YAML to JSON is actually one of the best debugging techniques for YAML. JSON has no implicit type coercion — every string is quoted, every number is explicit, and the structure is unambiguous. When you convert your YAML to JSON and see that a value you expected to be a string appears as a boolean or a number, you have found the bug. This converter makes that workflow instant: paste your YAML, see exactly how js-yaml interprets it, and identify any values that were silently converted to unexpected types.

YAML in the DevOps Ecosystem: Kubernetes, Docker, and CI/CD

YAML has become the universal language of DevOps and infrastructure-as-code. Kubernetes uses YAML for every resource definition — Deployments, Services, ConfigMaps, Secrets, Ingresses, PersistentVolumeClaims, CronJobs, and custom resources are all declared in YAML manifests. Docker Compose uses YAML (docker-compose.yml) to define multi-container applications with services, networks, volumes, and environment variables. GitHub Actions, GitLab CI, CircleCI, and Azure Pipelines all use YAML for pipeline definitions. Ansible uses YAML for playbooks and role definitions. Helm uses YAML for chart values and templates. Terraform uses YAML alongside HCL for variable files. The result is that a working DevOps engineer reads and writes dozens of YAML files every day.

The need to convert between YAML and JSON arises constantly in this ecosystem. Kubernetes accepts both YAML and JSON for all API calls, and tools like kubectl, kustomize, and Helm sometimes output JSON that needs to be converted to YAML for readability. Docker Compose configurations may need to be generated programmatically in JSON and then converted to YAML for use with docker compose. CI/CD pipeline configs written in YAML sometimes need to be validated or transformed using JSON-based tools. Ansible playbooks may need to consume JSON data from APIs and produce YAML output for other tools. Having an instant, private converter available in your browser removes friction from all of these workflows — paste, convert, copy, and continue working.

How It Works

1

Choose YAML-to-JSON or JSON-to-YAML mode.

2

Paste your input and click Convert.

3

Copy the converted output or swap to convert back.

Key Features

Convert YAML to JSON and JSON to YAML instantly
Powered by js-yaml — the most widely used JavaScript YAML parser
Implements the YAML 1.2 specification (fixes the Norway problem and boolean gotchas)
Handles nested objects, arrays, multiline strings, anchors, and aliases
Supports literal (|) and folded (>) block scalar styles
Swap button to quickly reverse the conversion direction
Clear error messages for invalid YAML or JSON syntax
Copy output to clipboard with one click
Runs entirely in your browser — no server round-trips
Private by design — data never leaves your device

Privacy & Trust

Data is converted locally in your browser
No data is uploaded or stored
No tracking of content
Built using open-source js-yaml library

Use Cases

1Convert Kubernetes manifests and Helm value files between YAML and JSON
2Convert Docker Compose files to JSON for programmatic editing or API consumption
3Convert CI/CD pipeline configs — GitHub Actions, GitLab CI, CircleCI, Azure Pipelines
4Transform Ansible playbooks or Terraform variable files between formats
5Debug YAML syntax errors by converting to the stricter JSON format
6Prepare JSON payloads from human-readable YAML drafts for REST APIs
7Migrate configuration between tools that expect different formats

Frequently Asked Questions

Is this YAML/JSON converter free?

Yes, it is completely free with no usage limits, no signup, and no per-conversion charges. Because the conversion runs locally in your browser using the js-yaml library, there are no server costs. You can convert as many files as you need, as often as you need, without creating an account or providing any personal information.

Is my data sent to a server or stored anywhere?

No. All conversion happens entirely inside your browser using JavaScript. Your YAML and JSON content never leaves your device — not even temporarily. There are no API calls, no cloud uploads, and no analytics on your data. This makes it safe for converting sensitive configuration files that contain API keys, database credentials, or internal infrastructure details. You can verify this by checking the Network tab in your browser DevTools while converting.

What is YAML and how does it differ from JSON?

YAML (YAML Ain't Markup Language) is a human-friendly data serialization format that uses indentation instead of braces and brackets to represent structure. It supports comments, multiline strings, anchors and aliases for reusable content, and a cleaner syntax for nested data. JSON (JavaScript Object Notation) is a lightweight data interchange format that is stricter, more verbose, and universally supported by APIs and programming languages. YAML 1.2 is a strict superset of JSON, meaning every valid JSON document is also valid YAML. The two formats represent the same data structures, so conversion between them is lossless for data (though YAML comments are lost in JSON since JSON has no comment syntax).

What is the Norway problem in YAML?

The Norway problem is a well-known YAML gotcha where the country code "NO" (for Norway) gets silently interpreted as the boolean value false. In YAML 1.1, a wide range of strings were treated as booleans — yes, no, on, off, y, n, and various capitalizations were all parsed as true or false instead of strings. This caused real bugs in projects dealing with country codes, environment variables, and toggle settings. YAML 1.2 fixed this by restricting boolean values to only true, True, TRUE, false, False, and FALSE. This tool uses js-yaml which implements YAML 1.2, so the Norway problem does not apply here.

What is js-yaml and why does this tool use it?

js-yaml is the most popular JavaScript YAML parser and serializer, with tens of thousands of dependent packages in the npm registry. It was originally a port of the Python PyYAML library but was completely rewritten from scratch for performance and correctness. js-yaml implements the YAML 1.2 specification and supports multiple schemas including FAILSAFE_SCHEMA (strings only), JSON_SCHEMA, CORE_SCHEMA, and DEFAULT_SCHEMA. It is fast, well-tested, actively maintained, and used in production by major tools and frameworks across the JavaScript ecosystem.

Does YAML support comments?

Yes, YAML supports single-line comments using the hash symbol (#). Comments can appear on their own line or at the end of a line after a value. This is one of the biggest advantages YAML has over JSON — you can annotate configuration files with explanations, TODOs, and context for other team members. However, when converting YAML to JSON, comments are lost because JSON has no comment syntax. There is no way to preserve YAML comments in JSON output. When converting JSON to YAML, no comments are added.

How do multiline strings work in YAML?

YAML supports two block scalar styles for multiline strings. The literal style, indicated by the pipe character (|), preserves newlines exactly as written — each line break in the YAML becomes a newline in the parsed string. The folded style, indicated by the greater-than sign (>), replaces single newlines with spaces, effectively folding the text into a single paragraph while preserving blank lines as paragraph breaks. Both styles also support chomping indicators to control trailing newlines: strip (-) removes all trailing newlines, clip (default) preserves a single trailing newline, and keep (+) preserves all trailing newlines. When converted to JSON, multiline strings become regular JSON strings with \n characters representing newlines.

What are YAML anchors and aliases?

Anchors and aliases are a YAML feature for reusing content without duplication. You define an anchor with the ampersand symbol (&name) on a node, then reference it elsewhere with an alias using the asterisk (*name). This is especially useful in large configuration files where the same block of settings appears multiple times — for example, shared environment variables across multiple services in a Docker Compose file or common labels across Kubernetes resources. When converted to JSON, anchors and aliases are resolved into their full expanded form since JSON has no equivalent feature. The merge key (<<) from YAML 1.1 was removed in YAML 1.2, but js-yaml still supports it for compatibility.

Can I convert Kubernetes YAML manifests to JSON?

Yes. Kubernetes accepts both YAML and JSON for all resource definitions — Deployments, Services, ConfigMaps, Secrets, Ingresses, CronJobs, and everything else. Most developers write Kubernetes manifests in YAML because the syntax is more readable, but certain tools and APIs require JSON input. This converter handles any valid Kubernetes YAML, including multi-level nesting, environment variable blocks, resource limits, volume mounts, and Helm chart value files. Just paste your manifest and get clean, valid JSON output.

Why is YAML so popular in DevOps and infrastructure?

YAML became the dominant configuration language in DevOps because it prioritizes human readability — no braces, no quotes around most strings, and indentation-based structure that visually mirrors the data hierarchy. Kubernetes chose YAML for manifests, Docker Compose uses it for service definitions, GitHub Actions and GitLab CI use it for pipeline workflows, Ansible uses it for playbooks, Terraform uses it for variable files, and Helm uses it for chart values. The result is that DevOps engineers read and write YAML daily. The ability to add inline comments is also critical for infrastructure configuration where documenting why a setting exists is as important as the setting itself.

What are the differences between YAML 1.1 and YAML 1.2?

YAML 1.2, released in 2009, made several important changes over YAML 1.1. The biggest change was fixing implicit boolean parsing — only true and false (and their capitalized variants) are now booleans, eliminating the Norway problem where yes, no, on, off were treated as booleans. Octal numbers now require a 0o prefix (so 010 is the number ten, not eight). YAML 1.2 was also redesigned to be a strict superset of JSON, meaning any valid JSON document is automatically valid YAML 1.2. Several rarely used types like !!timestamp, !!binary, !!pairs, and !!omap were dropped from the default schema. The merge key (<<) was also removed from the spec, though most parsers still support it for backward compatibility.

How does YAML compare to TOML?

YAML and TOML serve similar purposes but make different trade-offs. YAML excels at deeply nested data structures — its indentation-based syntax naturally represents complex hierarchies like Kubernetes manifests or Docker Compose files. TOML excels at flat or shallow configuration — its INI-like key-value syntax is cleaner for settings files like Cargo.toml, pyproject.toml, or .gitconfig. TOML has no implicit type coercion, which avoids YAML-style gotchas, but its syntax becomes verbose and hard to read with deep nesting. YAML supports comments, anchors, aliases, and multiline strings, while TOML supports comments and multiline strings but has no anchor or reuse mechanism. In practice, YAML dominates DevOps and infrastructure configuration, while TOML is popular in Rust (Cargo), Python (pyproject.toml), and Go ecosystems.

Does this tool support multi-document YAML?

This tool converts single YAML documents. YAML supports multiple documents in one file separated by the document start marker (---) and optionally ended with the document end marker (...). If you have a multi-document YAML file, split it at the --- boundaries and convert each document separately. The js-yaml library provides a loadAll function for multi-document parsing, but this tool focuses on single-document conversion for simplicity and clarity.

Why do I get errors when converting my YAML?

The most common causes of YAML parsing errors are incorrect indentation (YAML requires spaces, never tabs, and indentation levels must be consistent), unquoted special characters (colons, braces, brackets, or ampersands in values that need quoting), and implicit type issues (values like true, null, or 1.0 being interpreted as booleans, null, or numbers instead of strings). If your YAML fails to parse, check that you are using spaces for indentation, that string values containing special characters are quoted, and that values meant to be strings are not being silently converted to other types. Converting to JSON is actually a good debugging technique — the strict JSON output makes implicit type conversions visible.

Can I use this converter for Docker Compose files?

Yes. Docker Compose files are standard YAML and convert cleanly to JSON. This is useful when you need to programmatically generate or modify Compose configurations, feed them into tools that expect JSON input, or compare configurations using JSON-aware diff tools. The converter handles all common Compose constructs including service definitions, network configurations, volume mounts, environment variable blocks, build contexts, and depends_on relationships. After editing the JSON, you can convert it back to YAML for use with docker compose.

Limitations

  • Does not support YAML tags or custom types
  • Very large files may be slow in older browsers
  • Does not preserve YAML comments when converting to JSON
  • Converts single YAML documents — split multi-document files (---) first

Q&A SESSION

Got a quick technical question?

Skip the back-and-forth. Get a direct answer from an experienced engineer.