Skip to main content

JSON ↔ YAML Converter

Convert JSON to YAML or YAML to JSON for Kubernetes, Docker Compose and CI config files. Clean, readable output generated right in your browser.

YAML input

Stays in your browser

JSON output

Converted output will appear here.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JSON Parser, JSON Beautifier or JSON ↔ TOML Converter.

Free Online JSON ↔ YAML Converter

Convert YAML to JSON or JSON to YAML instantly, with clear error messages if the input isn't valid — no configuration needed either direction. It helps developers move configuration between YAML-based deployment files and JSON-based APIs or tooling.

JSON vs. YAML

JSON and YAML both represent the same kinds of structured data — objects/mappings, arrays/sequences, strings, numbers, booleans, and null — but with very different syntax. JSON uses braces, brackets, and quotes and is easy for machines to parse unambiguously. YAML uses indentation and minimal punctuation, making it more readable by hand, which is why it's the format of choice for configuration files (Kubernetes manifests, GitHub Actions workflows, Docker Compose files) even though APIs overwhelmingly use JSON.

How to convert between them

Choose a direction, paste your YAML or JSON into the input box, and click Convert. If the input isn't valid, the exact parsing error is shown instead of a blank or garbled result. Use Swap with output to immediately convert the result back, useful for verifying a round-trip conversion.

Common use cases

  • Converting a Kubernetes or Docker Compose YAML file into JSON for use with a tool that only accepts JSON
  • Turning an API's JSON response into more readable YAML for documentation or a config template
  • Debugging a YAML config file by round-tripping it through JSON to spot subtle indentation or type issues

Worked example

name: example items: - one - two converts to { "name": "example", "items": ["one", "two"] }. A plain alias like base: &b name: shared ref: *b resolves ref to { "name": "shared" }, and a merge key, first: <<: *b extra: 1, is expanded to { "name": "shared", "extra": 1 }.

Common mistakes and edge cases

  • YAML merge keys (<<: *anchor) are expanded into the surrounding mapping. A key you write yourself next to the merge key overrides the same key from the anchor.
  • Converting JSON to YAML never introduces anchors or aliases, even for two branches with identical content — JSON has no concept of shared references, so there's nothing for the converter to detect and deduplicate.

Frequently asked questions

Is my data uploaded anywhere when I convert it?
No — conversion runs entirely in your browser. Nothing you paste is ever sent to a server.
Why does my converted YAML look different from what I expected?
YAML has multiple valid ways to represent the same data (block style vs. flow style, quoted vs. unquoted strings) — the converter always produces block-style YAML with consistent 2-space indentation, which may differ stylistically from hand-written YAML even though the underlying data is identical.
What YAML features are supported?
Standard YAML 1.2/1.1 features: mappings, sequences, scalars, multi-line strings, comments (ignored on parse, since JSON has no comment equivalent), and null. A plain alias (a value referenced elsewhere with *name) resolves correctly to the anchor's value.
Do YAML merge keys (<<: *anchor) work?
Yes. A merge key (<<: *anchor) copies the anchor's fields into the mapping around it, and fields you write next to it win. A mapping with <<: *b and extra: 1 becomes { name: shared, extra: 1 } in JSON when the anchor holds name: shared.
Can I convert a JSON array at the top level?
Yes — both directions support any valid JSON value at the top level, including arrays, not just objects.
If my JSON has the same nested object repeated twice, will converting to YAML add an anchor for it?
No — in practice, converting JSON to YAML never produces anchors or aliases, even when two branches look identical. JSON has no way to express that two values are literally the same reference, so by the time this tool parses your JSON, it's already looking at two separate, distinct objects with no shared identity to detect.
Why did my YAML value change type after conversion?
YAML guesses the type of an unquoted value: yes, no, on and off can become booleans, 1.0 becomes a number and 2026-01-01 can become a date. If a value such as a version number or a postcode must stay text, put it in quotes in the YAML. The converted JSON shows the type each value really got.

Related tools

More Formatters & Parsers

View all Formatters & Parsers tools →