JSON to YAML Converter - Free & Browser Based
Paste JSON and get clean YAML with correct indentation, quoting only where it matters, and block scalars for multi line text. Nothing leaves your device.
Turning JSON documents into readable YAML
This converter takes a JSON document and rewrites it as YAML without sending anything to a server. It walks the parsed structure, indents nested maps and sequences, and only wraps a string in quotes when leaving it bare would change its meaning. Values that would otherwise be read back as numbers, booleans, dates or timestamps keep their quotes, multi line text becomes a literal block scalar, and empty objects and arrays collapse to the compact flow markers that YAML reserves for them.
The people who reach for it most often are platform engineers moving between two worlds. Kubernetes and Helm speak YAML, while the API server, kubectl and most cluster tooling hand you JSON. Terraform state files, CloudFormation templates and workflow exports arrive the same way. Rather than hand indenting a two hundred line manifest, you paste the JSON, pick two space or four space indentation, and get a manifest you can commit straight into a Git repository.
Conversion is a two step process in the browser. The JSON is parsed with the native parser, so a stray trailing comma or an unquoted key fails immediately and the character position is translated into a line and column you can jump to in your editor. The resulting value tree is then serialised by a writer that tracks indentation depth as a string rather than a counter, which keeps sequence items aligned under their parent key even when you switch from two spaces to four.
Two options change the output in ways worth knowing. Sorting keys alphabetically makes two generated manifests diffable, which matters when you compare what a controller wrote back against what you committed. The null style toggle decides whether a JSON null becomes the explicit word null or an empty value after the colon. Both parse back to the same thing, but linters in some pipelines flag one of them, and Helm templates treat an empty value differently from a literal null.
Round tripping is worth checking once for any large document. Paste the result into the YAML to JSON Converter on ToolForte and compare it with your source, or run the input through the JSON Formatter first so that key order and structure are easy to read while you work. Comments cannot survive the trip in either direction, since JSON has no syntax for them, so anything you want documented has to be added to the YAML by hand afterwards.
How the JSON to YAML Converter Works
- 01Paste a JSON document into the input box or drop a .json file onto it. The YAML appears as you type, so there is no convert button to press.
- 02Choose two or four space indentation, decide whether keys should be sorted alphabetically, and pick how a null value should be written.
- 03Check the output. Strings that could be misread as numbers, dates or booleans are quoted for you, and any value containing newlines becomes a literal block scalar.
- 04Copy the YAML to your clipboard or download it as a .yaml file that is ready to commit to a repository.
Getting predictable YAML out of a JSON document
The hard part of writing YAML by hand is not the indentation, it is knowing which values must be quoted. YAML infers types from the way a scalar looks, so a build number written as 0042 becomes the integer 42, a release date written as 2026-03-14 becomes a timestamp object in some parsers, and a version written as 2.10 becomes the float 2.1. This converter applies those rules in reverse: every string coming out of the JSON is tested against the patterns that would trigger type inference, and only the ones that need protection are wrapped in double quotes. The result stays readable because ordinary words are left bare. Multi line strings are handled separately. A value containing newlines is written as a literal block scalar introduced by a pipe, with each line indented under the key, provided no line begins or ends with whitespace that the block form would silently swallow. When that condition is not met the value falls back to a quoted single line with escape sequences, which is uglier but never lossy. Empty objects and arrays are written as the flow markers so they stay on one line, and deeply nested sequences of mappings are aligned two columns past the dash so that the file parses back identically whichever indentation width you picked.
When to Use the JSON to YAML Converter
Reach for it whenever a tool hands you JSON but the file you have to maintain is YAML. That covers exporting a running Kubernetes resource with kubectl and turning it into a manifest, converting a CloudFormation or Serverless template that started life as JSON, moving an ESLint or Prettier config into a YAML variant, and translating an API response into a fixture file for a test suite. It is also the fastest way to make a machine generated JSON blob readable, because YAML drops most of the punctuation and lets the indentation carry the structure.
Common Use Cases
- Turning a kubectl get output into a manifest you can edit, review and commit.
- Rewriting a JSON CI configuration as a YAML pipeline definition for GitHub Actions or GitLab.
- Making a large machine generated payload readable before pasting it into a bug report.
- Checking the result by converting it straight back YAML ↔ JSON Converter - Instant & Free
- Tidying the source JSON first when the indentation is inconsistent JSON Formatter & Validator - Instant Results
Expert Tips
- Quote version numbers in the source JSON if they must stay strings. A value of 2.10 arrives as the number 2.1 before the converter ever sees it, because that loss happens inside JSON itself.
- Two space indentation is the convention for Kubernetes and most CI systems. Four spaces reads better for deeply nested application configuration that humans edit often.
- Comments cannot be generated from JSON. Add them to the YAML after conversion, and keep the YAML as the source of truth from that point on so they are not lost on the next round trip.
Frequently Asked Questions
- YAML guesses the type of an unquoted scalar. Values that look like a number, a boolean, a date, a time, a hexadecimal literal or one of the reserved words such as null, yes or off are quoted so they come back as strings. Everything else is written plainly to keep the file readable.
- No. Mappings in YAML and objects in JSON are unordered, so sorting is purely cosmetic. It is useful when you want to diff two generated files without noise from key order, but be aware that a reviewer comparing the sorted output against the original JSON will see a lot of moved lines.
- You choose. The explicit form writes the word null after the colon, which is unambiguous for every parser. The empty form leaves nothing after the colon, which is more idiomatic in hand written YAML. Both parse back to null, but Helm and some linters treat an empty value differently, so pick the one your pipeline expects.
- Not from a single JSON document. If you need several documents in one file, convert each JSON object separately and join the results yourself with a line containing three hyphens between them.
Why are some strings quoted and others left bare?→
Does sorting keys change the meaning of the document?→
What happens to a null value?→
Can it produce multi document YAML with the three dash separator?→
Related tools
12 suggested- 01TSV to CSV Converter - Free & PrivateConvert tab separated data to RFC 4180 CSV with proper quoting, a semicolon option for Excel and a UTF-8 BOM toggle. Free and fully browser based.
- 02CSV to Markdown Table Converter - Free & PrivateConvert CSV to a Markdown table with per column alignment and RFC 4180 quoted field support. Free, browser based, nothing is uploaded to a server.
- 03XML to JSON Converter - Free & PrivateConvert XML and SOAP responses to JSON in your browser. Configurable attribute prefix, namespace handling and arrays for repeated tags. Free and private.
- 04YAML to JSON Converter - Free & PrivateConvert YAML to JSON online. Nested maps, sequences, inline flow style, comments and block scalars, with line numbered errors. Free and browser based.
- 05HTTP Headers Checker - Free Response ViewerSee the status code, redirect chain and every response header for any URL, plus a free pass or fail audit of the six key security headers. No signup.
- 06DNS Lookup - A, MX, TXT, NS & MoreQuery A, AAAA, MX, TXT, NS, CNAME, SOA, and CAA records for any domain via DNS-over-HTTPS. Free browser-based DNS lookup with a query-all mode.
- 07ZIP Extractor - Open ZIP Files OnlineOpen and extract ZIP files directly in your browser: list contents, preview text and images, download files. Free and private - nothing is uploaded.
- 08User Agent Parser - Browser & OS LookupParse any user agent string to identify browser, version, engine, OS, and device type, including bots. Free, instant, and fully browser-based.
- 09HTML to JSX Converter - Free & InstantConvert HTML to valid React JSX instantly: className, camelCase attributes, style objects, and self-closed tags. Free, browser-based, and private.
- 10.htaccess Redirect Generator - Apache & NginxGenerate 301 and 302 redirect rules for Apache .htaccess and Nginx, with HTTPS, www, and trailing-slash templates. Free and fully browser-based.
- 11Generate .env.example Files - Free & PrivatePaste a .env file and instantly get a .env.example with secret values stripped. Free, browser-based, and private - credentials never leave your device.
- 12JSON Formatter & Validator - Instant ResultsFormat, validate, and minify JSON with instant error highlighting. Pinpoints syntax errors. Free, private, browser-based.