Your files never leave your device. All processing happens locally in your browser.
How do I convert JSON to YAML (or YAML back to JSON) without uploading my file?
Open the JSON to YAML Converter, then paste or drop a .json file (or a .yaml / .yml file to go the other way) and it parses and re-emits the data in your browser with the js-yaml library, printing the converted result live as you type. The direction auto-detects from the file extension and you can flip it with the Swap button; because JSON is a strict subset of YAML 1.2, JSON → YAML is always safe, while YAML → JSON keeps strings, numbers, booleans, null, arrays and objects intact. Pick a DevOps preset — Kubernetes, Docker Compose, GitHub Actions, Ansible or OpenAPI — or open Advanced to set indent (2/3/4), line width, quote style, block vs flow level, key sorting, anchor/alias stripping, a leading --- document marker and the YAML 1.1 or 1.2 schema. Every conversion is round-trip verified: the output is parsed back and compared to the input, so the tool labels the result lossless or flags a lossy edge case. Copy the result, download it as .yaml or .json, load a sample or fetch a file from a URL — and nothing ever leaves your device.
Convert both ways — JSON → YAML and YAML → JSON — with live preview and a one-click Swap
DevOps presets: Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI, plus indent, quoting, flow-level and schema controls
Round-trip verified — the output is re-parsed and compared to prove the conversion is lossless (or to flag a lossy case)
YAML 1.2 (JSON-compatible) or YAML 1.1 schema to control the “Norway problem” where yes/no/on/off parse as booleans
100% client-side — data is parsed in your browser with js-yaml and never uploaded
What is
JSON to YAML Converter
A JSON to YAML converter transforms structured data between two serialization formats. JSON (JavaScript Object Notation, RFC 8259) is a compact bracket-and-quote syntax used by APIs and config files; YAML (“YAML Ain’t Markup Language”) is a human-friendly, indentation-based format that drops most brackets and quotes and adds comments (#), anchors (&) and aliases (*) for reuse, multi-line block scalars, and multiple documents in one stream. Because YAML 1.2 is a strict superset of JSON, every JSON document is already valid YAML, so JSON → YAML is a safe, always-possible transform: the converter parses the JSON into an in-memory data structure and re-serialises it in YAML’s block style with indentation and list dashes. Going the other way, YAML → JSON resolves YAML’s richer scalars back to JSON’s six types — string, number, boolean, null, array and object. The classic pitfall is implicit typing: under the YAML 1.1 rules still used by many parsers, the bare words yes, no, on and off and the country code NO become booleans (the “Norway problem”), and a value like 3.10 can collapse to 3.1 — which is why quoting and schema choice matter, and why a good converter round-trips its output to prove it is lossless. Note that YAML comments and anchor names live outside the data model, so they are not preserved through a JSON round trip. This tool runs entirely in the browser with the js-yaml library and never uploads your data.
File Tools
Related terms
JSONYAMLYAML 1.1YAML 1.2js-yamlKubernetes manifestDocker ComposeGitHub ActionsOpenAPIAnsibleNorway problemanchors and aliasesblock vs flow styleserializationRFC 8259
Frequently Asked Questions
No. The JSON or YAML is parsed and re-serialised entirely in your browser with the js-yaml library — there is no upload, server or account, so the data never leaves your device.
Nothing is uploaded. When you paste text, drop a file or click Sample, the converter reads it locally and runs the whole parse-and-emit pipeline in memory on your device using the bundled js-yaml library, re-converting live (debounced) as you type. There is no server, API, database or tracking in the processing path, so a private Kubernetes secret, an API response or any other sensitive config stays on your machine; the tool works offline once cached, and closing the tab discards everything. The one case where data touches the network is if you paste a remote URL for the tool to fetch, and even then the response is downloaded straight into your browser and converted there, never sent anywhere else — and that fetch needs the remote server to allow cross-origin requests (CORS). The only optional network use anywhere on the site is consent-gated advertising, which never sees your data.
JSON → YAML is lossless because YAML 1.2 is a superset of JSON; the tool re-parses its output and labels it lossless or flags a lossy edge case. Comments and anchor names are not kept on a round trip.
Converting JSON to YAML preserves every value, because YAML 1.2 can represent anything JSON can — the tool proves it by parsing the YAML it produced back into a data structure and deep-comparing it to your input, then showing a green “lossless” badge or an amber “lossy” warning that explains the difference (usually caused by a quoting-style or schema setting). Two things are genuinely outside the data model and cannot survive a JSON round trip: YAML comments (# lines) and the human-readable names of anchors and aliases — a repeated block written with &anchor/*alias is expanded into duplicated data when it becomes JSON. Numeric precision is another edge to watch: very large integers beyond JavaScript’s safe range, or values like 3.10, can normalise, and the lossy badge will tell you when that happens so you can quote the value or switch schema.
Use the Kubernetes or Docker Compose preset — 2-space block style, no anchors, no line wrap — and keep the YAML 1.2 schema so words like yes/no/on/off stay plain strings.
The presets pre-load the conventions each toolchain expects. Kubernetes and Docker Compose both want two-space block indentation, no line wrapping and no anchors/aliases (so kubectl, Helm and docker compose read the file cleanly), and Kubernetes adds a leading --- document separator. GitHub Actions and Ansible use similar 2-space block styles, while OpenAPI keeps an 80-column wrap. For the schema, prefer YAML 1.2 (the JSON-compatible core schema) so bare yes, no, on and off remain strings rather than booleans — important because a Kubernetes value like a port name or a country code “NO” must not silently become true/false. You can always start from a preset and then fine-tune indent, quote style or the --- marker in the Advanced panel.
In YAML 1.1, NO, yes, on and off parse as booleans, so “NO” (Norway) becomes false. Choose the YAML 1.2 schema or force quoting so string values survive.
The “Norway problem” is the most famous YAML foot-gun: the YAML 1.1 spec treats a whole family of bare words — yes, no, on, off, y, n and their capitalisations — as booleans, so a list of country codes containing NO turns Norway into false, and on/off flags become true/false unexpectedly. YAML 1.2 fixed this by recognising only true and false, but many real-world parsers still default to 1.1 behaviour. This converter lets you pick the schema: the default YAML 1.2 (JSON-compatible) schema keeps those words as plain strings, and you can additionally set the quote style to force double or single quotes so any string that looks like a boolean, number or date is quoted in the output. When in doubt, quote it — and the round-trip check will confirm the value came back as the string you intended.
Detailed Explanation
📖How It Works
Converting Between JSON and YAML in Your Browser
The JSON to YAML Converter transforms structured data between the two most common configuration formats without uploading anything. Paste or drop a .json file to produce YAML, or a .yaml / .yml file to produce JSON — the direction auto-detects from the extension and a Swap button reverses it, feeding the previous output back in as the new input. Conversion is live: as you type, the tool parses the source with the js-yaml library and re-serialises it, printing the result beside your input along with byte and line counts. Because YAML 1.2 is a strict superset of JSON, JSON → YAML always succeeds and preserves every value, turning brackets and quotes into indentation and list dashes; YAML → JSON collapses YAML’s richer syntax back to JSON’s six types. On invalid input the tool reports the exact line and column of the parse error instead of failing silently.
Bidirectional: JSON → YAML and YAML → JSON, auto-detected from the file extension
Live conversion with the js-yaml library, plus a one-click Swap
YAML 1.2 is a superset of JSON, so JSON → YAML is always safe
Invalid input shows the exact line:column of the error
📋Use Cases
Presets for Kubernetes, Docker Compose and CI/CD
Most people convert JSON to YAML to feed a DevOps toolchain, so the tool ships one-click presets that pre-configure the output for each target. The Kubernetes preset uses two-space block indentation, no line wrapping, no anchors/aliases and a leading --- document marker so kubectl, Helm and Kustomize read the manifest cleanly; Docker Compose is the same block style without the separator; GitHub Actions and Ansible mirror the 2-space block convention (Ansible adds ---), and OpenAPI keeps an 80-column wrap. A common workflow is pasting an API JSON response or a generated config and getting a ready-to-commit manifest, or going the other way to turn an existing values.yaml or workflow file into JSON for a script to read. Every preset can be fine-tuned afterwards in the Advanced panel.
Presets: Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI
Kubernetes / Compose output is 2-space block style with no anchors and no wrap
Turn an API JSON response into a ready-to-commit manifest, or a manifest into JSON
Any preset can be tuned further in the Advanced panel
🔧Technical Details
Engine, Options and Round-Trip Verification
Conversion runs entirely client-side on the js-yaml library, which is dynamically imported the first time you convert. For JSON → YAML the tool parses the JSON (with a helper that pinpoints the failing line and column) and calls yaml.dump with your chosen options: indent (2/3/4), lineWidth, flowLevel (always-block through always-flow), forced single or double quoting, sortKeys, noRefs to drop anchors/aliases, and the schema — JSON_SCHEMA for YAML 1.2 or DEFAULT_SCHEMA for 1.1 — with an optional leading --- prepended. For YAML → JSON it loads the YAML under the same schema and stringifies with a minified, 2-space or 4-space indent. Crucially, every result is round-trip verified: the output is parsed back and deep-compared with the input, so the tool shows a green “lossless” badge when they match, or an amber “lossy” warning that names the cause (usually a quoting or schema setting) when they differ.
Powered by js-yaml, imported on demand and run 100% in the browser
Schema switch: JSON_SCHEMA (YAML 1.2) or DEFAULT_SCHEMA (YAML 1.1)
Output is re-parsed and deep-compared for a lossless / lossy verdict
⚠️Limitations
Honest Limitations
A JSON round trip preserves only the data model, so two things are dropped: YAML comments (# lines) and the human-readable names of anchors and aliases — a block written with &anchor and reused with *alias is expanded into duplicated data once it becomes JSON. Implicit typing is the other pitfall: under the YAML 1.1 schema the bare words yes, no, on, off and the country code NO are read as booleans (the “Norway problem”), and a value like 3.10 can normalise to 3.1, so choose the YAML 1.2 schema or force quoting when a string must stay a string — the lossy badge flags these cases. Very large integers beyond JavaScript’s safe range may lose precision because parsing goes through native JSON numbers. Inputs are capped at 25 MB since everything is held in browser memory, and loading a file from a remote URL only works when that server sends permissive CORS headers, otherwise the fetch fails with a clear message.
YAML comments and anchor / alias names are not preserved through a JSON round trip
YAML 1.1 turns yes/no/on/off and NO into booleans (the “Norway problem”) — use 1.2 or quote
Very large integers can lose precision via native JSON numbers
25 MB input cap (browser memory); remote-URL loading needs permissive CORS
🔒Privacy & Security
Privacy: Your Data Stays on Your Device
The configs you convert are often sensitive — Kubernetes secrets, CI/CD credentials, internal API responses or proprietary infrastructure definitions — and this tool is built so they never leave your machine. The JSON or YAML is read and converted entirely in memory with the bundled js-yaml library, with no server, upload, database, logging, API or CDN anywhere in the processing path. The tool works offline once cached, and closing the tab discards everything. The only moment anything touches the network is if you explicitly paste a remote URL for the tool to fetch, and even then the response is downloaded straight into your browser and converted there, sent nowhere else. The only optional network use anywhere on the site is consent-gated advertising, which never sees your data.
Read and converted entirely in the browser with js-yaml
No server, upload, database, API or CDN in the processing path
Works offline once cached; closing the tab discards everything
Only optional network use is consent-gated ads, which never see your data
JSON to YAML Converter — directions, options and limits
Capability
Support
Notes
Directions
JSON → YAML and YAML → JSON
Auto-detected from the file extension; one-click Swap reuses the output as input
The converter parses JSON or YAML with the js-yaml library in your browser and re-serialises it the other way, live, with a one-click Swap and extension auto-detect. Presets configure the output for Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI, while the Advanced panel exposes indent, line width, quote style, flow level, key sorting, anchor stripping, a --- marker, the YAML 1.1/1.2 schema and the JSON indent. Every result is round-trip verified and labelled lossless or lossy; YAML comments and anchor names are not preserved through a JSON round trip, the YAML 1.1 schema causes the “Norway problem”, inputs are capped at 25 MB, and remote-URL loading needs permissive CORS. Everything runs in the browser; nothing is uploaded.