What does a JSON to YAML converter do?
It parses a JSON document and re-serializes the same data as YAML — the whitespace-structured format that Kubernetes, GitHub Actions, Docker Compose and most infrastructure tooling expect. The two formats are structurally equivalent (any valid JSON maps to YAML), so nothing is lost: objects become mappings, arrays become dash-prefixed sequences, and the braces, brackets and most of the quotes disappear in favor of indentation.
The converter validates as it goes — invalid JSON produces a parser error, not silently wrong YAML — and it quotes strings only where YAML requires it, so values like "yes", "8080" or "null" stay strings instead of being reinterpreted. Conversion runs entirely in your browser; your payloads are never uploaded or logged.
When to use it
The typical trigger is having data in JSON that needs to live in a YAML file: an API response you want to turn into a fixture, a JSON config you're migrating to a Helm values file or CI pipeline, a policy document from AWS that belongs in a CloudFormation-style template. Writing the YAML by hand invites indentation mistakes; converting guarantees the structure matches the source.
It's also worth converting purely for readability. Deeply nested JSON with escaped quotes is painful to review; the same data as YAML is flatter visually and diff-friendlier in code review. The output comes syntax-highlighted, and the "Copy link to this result" button gives you a permalink that restores your exact JSON input — handy for asking a teammate "is this the structure you meant?"
Example
Paste {"service": {"name": "api", "replicas": 3, "ports": [8080, 8443], "debug": "false"}} and Convert. The output is:
service: name: api replicas: 3 ports: - 8080 - 8443 debug: "false"
Note that debug kept its quotes: an unquoted false would be parsed as a boolean by any YAML consumer, so the converter protects the string. That kind of automatic disambiguation is the main reason to convert rather than hand-write.
YAML gotchas a JSON to YAML converter has to handle
The Norway problem. Under YAML 1.1 rules, which PyYAML, Ruby's Psych and many older tools still follow, the bare words yes, no, on and off are booleans — so a list of country codes containing NO turns into false. This converter quotes those words in any case ("NO", "on", "Yes"), as well as true, false, null and ~, so they stay strings whichever YAML version the consumer implements. A few parsers also treat a single y or n as a boolean; those are not quoted here, so quote them by hand if your consumer is one of them.
Numbers that are really strings. Version numbers, ZIP codes and octal-looking values such as "1.10", "02134" and "0755" are quoted, because a bare 1.10 is read back as the float 1.1 and 0755 can become the integer 493. Dates are not: a string like 2026-11-07 is emitted unquoted, and YAML 1.1 parsers (PyYAML among them) load it as a date object. Quote date strings yourself if the consumer must see text.
Indentation. Output always uses two spaces per level and never tabs — YAML forbids tabs for indentation, and mixing widths is the most common reason a hand-edited file stops parsing. Keep the two-space convention when you edit the result.
Multiline strings. A JSON string containing newlines is written as a double-quoted YAML string with \n escapes, which is valid and round-trips exactly. If you would rather have a readable block, rewrite it by hand as a literal block scalar (key: | followed by indented lines, which keeps newlines) or a folded one (key: >, which joins lines with spaces).
Convert JSON to YAML on the command line with yq or Python
For files in a repo or a CI step, use a CLI instead of pasting. With yq (the Go version by Mike Farah): yq -p json -o yaml config.json > config.yaml. Recent versions also accept yq -P config.json, where -P pretty-prints as YAML.
With Python and PyYAML: python3 -c 'import sys, json, yaml; print(yaml.safe_dump(json.load(sys.stdin), sort_keys=False, allow_unicode=True))' < config.json > config.yaml. sort_keys=False keeps the original key order, which PyYAML would otherwise sort alphabetically.
With Node.js and the yaml package (npm i yaml): node -e 'const YAML = require("yaml"); console.log(YAML.stringify(JSON.parse(require("fs").readFileSync(0, "utf8"))))' < config.json. All three quote ambiguous scalars, though each library has its own rules for exactly which ones.
How to use the JSON to YAML Converter tool
- 1
Paste your JSON
An API response, config file, or any valid JSON document goes in the left panel.
- 2
Convert
Hit Convert to YAML. Invalid JSON shows the parser error instead of broken output.
- 3
Review the output
Syntax-highlighted YAML appears on the right, with strings quoted only where YAML demands it.
- 4
Copy or share
Copy the YAML into your config file, or copy a permalink that restores your exact input.
Frequently asked questions
Why are some strings quoted in the output and others not?
YAML reinterprets certain bare words: true/yes/no/off become booleans, 123 becomes a number, empty strings vanish. The converter quotes exactly those risky values — "yes", "8080", strings with colons or leading special characters — and leaves safe strings unquoted for readability.
Why does conversion fail on my input?
The input must be strict JSON: double quotes only, no trailing commas, no comments, no unquoted keys. The error message comes straight from the JSON parser and points at where it stopped. Run the input through the JSON Formatter tool first if you need help pinpointing the problem.
Will the YAML round-trip back to my original JSON?
Yes — the output uses plain mappings, sequences and scalars with no YAML-only features, so converting back with the YAML to JSON tool yields the same data. Key order and all types are preserved in both directions.
Is my JSON sent to a server?
No. Parsing and serialization run entirely in your browser, so API responses containing real customer or infrastructure data never leave your machine. Even the shareable permalink stores your input in the URL fragment, which browsers don't transmit to servers.
What is the Norway problem in YAML?
In YAML 1.1 an unquoted NO (and yes, no, on, off in any case) is parsed as a boolean, so the country code for Norway becomes false. YAML 1.2 fixed it, but many parsers still use 1.1 rules. This converter quotes those words so they survive either way.
Does the converter output tabs or spaces?
Always two spaces per nesting level. YAML does not allow tabs for indentation, and two spaces is the convention used by Kubernetes, GitHub Actions and Docker Compose examples.
How are multiline strings converted?
As double-quoted strings with \n escapes, which preserve the text exactly. If you prefer a readable block in the YAML file, change it to a literal block scalar (|) by hand after converting.
How do I convert JSON to YAML in a script or CI job?
Use yq: yq -p json -o yaml input.json > output.yaml. In Python, yaml.safe_dump(json.load(f), sort_keys=False) does the same and keeps key order.
Related on TechLogHub
Related JSON Tools
JSON Formatter with Parse Error Positions
Format, validate, and beautify JSON with syntax highlighting
JSON to TypeScript Converter
Convert JSON to TypeScript interface and type definitions
JSON to Zod Schema Generator
Generate Zod validation schemas from any JSON object
YAML to JSON Converter
Parse YAML and convert it to formatted JSON with validation
Get the next tool before you need it
One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.