9314JIUsi
Developer tools · runs in your browser

JSON Formatter, Validator & YAML Converter

A 40,000-character one-line API response hides its broken comma well. Paste it in: pretty-print, minify, or escape it in one click, with syntax errors resolved to a row and column. The same box converts between JSON and YAML both ways — pick your indent, sort keys if you want, and YAML syntax errors get a line number too.

InputJSON or YAML
OutputResult
Direction

Everything you type stays in this browser: nothing is uploaded, and there is no account. Interface options such as indent, key sorting, and direction are saved on this device and are lost when you switch devices or clear site data. Use "Clear my data" in the footer to remove them.

How to use it

  1. Paste JSON or YAML into the left box — you do not have to know which one it is, "Convert" auto-detects. Or click "Sample JSON / Sample YAML" to see it work first.
  2. On the JSON side, click what you need: "Format" to see the structure, "Minify" to squeeze it into one line, "Escape \n" to embed it as a string literal, "Unescape" to recover a string pulled out of a log.
  3. When syntax breaks, the area under the input turns red: JSON errors resolve to a row and column, YAML errors carry the line number. Fix the spot and run it again.
  4. The result lands on the right: copy it, download it (.yml / .json), or click "Move output to input" to convert it back and check the round trip.

When you actually reach for it

Debugging an API integration, mostly. The backend hands you a single-line response, three levels of nesting are invisible to the eye, and one extra comma is hiding in there. One click of "Format" unfolds the whole tree, and the missing or misplaced quote shows itself immediately.

Then there is the config-file side of life: pasting a JSON blob into a YAML file for Kubernetes, GitHub Actions, or docker-compose — or checking a YAML config against what the API actually returns. Two pastes and one click each way, no extra converter tab, no upload.

Embedding JSON into source code is the third one. Multi-line content has to collapse into one line and every double quote needs a backslash; doing that by hand is how broken string literals get shipped. "Minify" plus "Escape" produces a paste-ready literal, and "Unescape" reverses the ones you dig out of logs.

What the YAML side supports

Supported: mappings (key: value), sequences (- item), indentation nesting, flow style ([a, b] and {k: v}, multi-line included — which means pretty-printed JSON is itself valid input), single- and double-quoted strings, numbers, booleans, null (null / ~ / empty), # comments, and block scalars | and > with - / + chomping. Dates and timestamps stay strings on purpose. YAML 1.1 booleans like yes / no are treated as strings, so the two standards never fight over your data.

Not supported (fails loudly with a line number, never silently): anchors and aliases (&anchor / *ref), multi-document streams (---), tags (!!str), complex keys (?), merge keys (<<), and Tab indentation (YAML itself forbids it).

FAQ

Is my data uploaded to a server?

No. Pretty-printing, minifying, escaping, and YAML conversion all happen in your own browser. The page has no upload endpoint and works offline; what you paste never leaves your machine. Only interface options such as indent and key sorting are stored on this device.

What YAML syntax is supported?

Mappings, sequences, indentation nesting, flow style ([a, b] and {k: v}), single- and double-quoted strings, numbers, booleans, null (null, ~, or empty), comments, and block scalars | and > (including |- and >-). Dates stay strings. Anchors & and *, multi-document ---, tags !!, and complex keys ? are not supported — they fail loudly with the line number instead of silently mangling your data.

How do I use the reported line and column numbers?

JSON errors come from the browser's native JSON.parse and are converted to a line and column; YAML errors are reported by the parser built into this page. Both refer to the current text in the input box — count over to the spot, fix it, and run the operation again.

How do I convert YAML back to JSON after converting JSON to YAML?

Click "Move output to input" to shift the YAML result into the left box; the direction auto-detects YAML to JSON, and one more click converts back. The round trip preserves structure and values; key order follows your key-sorting option.

How large a file can it handle?

Parsing happens in the browser, so several-megabyte JSON is smooth and tens of megabytes depends on your device's memory — no upload means no server-side limit. The YAML parser scans line by line, so a typical config file of a few hundred to a few thousand lines is instant.

Why did my non-ASCII text turn into backslash-u sequences?

It did not — JSON.stringify does not escape non-ASCII characters. If you see \u4E2D-style output, the original text was already escaped when you received it. Click "Unescape" or paste the content again and the characters come back; this is a classic trap in API responses.

Related tools