🔄 JSON to YAML / YAML to JSON Converter
Convert between JSON and YAML formats bidirectionally with indentation control and real-time statistics.
Last updated: November 8, 2026 · By the BoltQuickTools team
Moving data between JSON and YAML without retyping it
An API hands you JSON but the deployment file wants YAML, or a script only reads JSON and your settings live in a YAML file. Rewriting the structure by hand is slow, and one wrong indent changes the meaning. This page converts in either direction, and it handles straightforward config well. Read the limits below before trusting it with a complicated YAML file.
Running a conversion
- Paste into the JSON panel or the YAML panel. The buttons Simple, Nested, Arrays and Complex load a sample into the JSON panel and convert it straight away.
- Pick 2 spaces or 4 spaces in the Indent dropdown. It applies to the output of either direction.
- Click JSON ➔ YAML or YAML ➔ JSON. Nothing converts until you click. The result replaces the content of the other panel.
- Use Copy JSON, Copy YAML or Clear. Line and character counts sit above each panel.
Two conversions, with the real output
JSON to YAML, with 2-space indent:
{"server":{"host":"localhost","port":8080,"tls":true},"tags":["api","v2"],"url":"https://example.com","retries":"3","note":null}
produces:
server:
host: localhost
port: 8080
tls: true
tags:
- api
- v2
url: "https://example.com"
retries: "3"
note: null
The string "3" keeps its quotes so it stays a string. The URL is quoted because it contains a colon. Keys that open a nested block carry a trailing space, which YAML parsers ignore.
YAML to JSON shows how plain values get typed:
# service config
name: web
port: 8080
enabled: yes
version: 1.20
country: NO
tags: [a, b]
produces:
{
"name": "web",
"port": 8080,
"enabled": true,
"version": 1.2,
"country": false,
"tags": [
"a",
"b"
]
}
The comment is gone, yes became true, NO became false, and 1.20 became the number 1.2. Quote those values in the YAML if you need them kept as text.
YAML this parser gets wrong
The YAML side is a small hand-written parser, not a full implementation. Some input produces an error, but several cases give incomplete output with no warning, so compare the result against your source.
- A leading
---line: the whole result is the string"---"and everything after it is lost. Delete the marker first. Multi-document files are not supported. - Lists at the same column as their key:
containers:followed by- name: webwith no extra indent gives{"containers": null}, and later keys are dropped. Indent the list under the key. - A line with no colon inside a mapping ends parsing silently.
a: 1,b,c: 2returns only{"a": 1}. - Comments after some values:
a: [1, 2] # notebecomes an empty array, andb: "x" # notekeeps the quotes and the comment as part of the string. Comments after plain values are removed correctly. - Anchors and aliases (
&name,*name,<<) are not expanded. A block anchor stops with anUnexpected indentationerror. - Flow lists spread over several lines stop with the same error. Block scalars with an indent number such as
|2are not recognised either. - Integers above 9,007,199,254,740,991 lose precision in both directions:
12345678901234567890comes out as12345678901234567000. Keep long IDs as quoted strings.
In the other direction, a string containing line breaks is written as a | block, which gains a trailing newline when converted back. A bare top-level JSON string with a line break comes out as just |, losing its content.
For checking that JSON is valid, the JSON formatter is a better fit. If your target is TOML or INI, use the TOML converter. The article on YAML, TOML and JSON5 covers how the formats differ.
Common questions about this converter
Can I paste a Kubernetes manifest?
Only after adjusting it. Remove any --- line and make sure lists are indented under their parent key. Output from kubectl get -o yaml commonly places lists at the same column as the key, and those lists are dropped.
Are my comments kept if I convert to JSON and back?
No. JSON has nowhere to store them, so they are discarded on the first conversion.
Does the config I paste get uploaded?
The conversion functions in this page make no network calls. The page does load analytics, plus ads if you accept them, so treat live secrets with your usual care.