What does this tool do?
It is a JSON and YAML workbench that runs entirely in your browser. Paste or drop a file into the editor and it is parsed immediately: if something is wrong you get every problem with its line and column, a plain-language explanation and, for broken brackets, a guess at where the missing one belongs. When the input is valid you can pretty-print it, minify it, sort its keys, or convert JSON to YAML and back. The diff pages compare two versions of a file and show only what changed.
Unlike most online formatters, the JSON parser here is written for diagnostics rather than speed. A browser's built-in JSON.parse stops at the first problem with a message such as Unexpected token. This parser keeps going, collects every issue in one pass, and builds a repaired version, so you can fix a whole file at once instead of one error per attempt.
All tools
- JSON formatterPretty-print with 2 or 4 spaces or tabs, sort keys.
- JSON validatorExact line and column of every error, with fixes.
- JSON minifierStrip whitespace to a single line.
- YAML formatterRe-indent YAML and keep the comments.
- YAML validatorIndentation, tabs, duplicate keys, YAML 1.1 traps.
- JSON to YAMLLossless conversion, big numbers kept.
- YAML to JSONAnchors, merge keys and multiple documents.
- JSON diffCompare two JSON files, ignore key order.
- YAML diffCompare YAML configs path by path.
- Text diffLine and word differences between two texts.
How to format or validate JSON and YAML
- Paste, drop or open a file. The badge shows whether it was read as JSON or YAML, and the status line updates as you type.
- Read the problems list. Each entry has a button that jumps to the exact position in the editor; affected lines are highlighted in the gutter.
- Click Format, Minify or a conversion. Pick 2 spaces, 4 spaces or tabs and decide whether keys should be sorted.
- Copy or download the result, or click Use as input to keep working on it.
The JSON errors it catches
These are the mistakes people make most often when editing JSON by hand or copying it from JavaScript, Python or a log file. All of them are reported with a position and fixed by the Fix JSON button:
| What you wrote | What the validator reports | Valid JSON |
|---|---|---|
{"a": 1,} | Trailing comma before "}" | {"a": 1} |
{"a": 1 "b": 2} | Missing comma after the value on line 1 | {"a": 1, "b": 2} |
{"a": [1, 2} | Expected "]" to close the array opened on line 1 | {"a": [1, 2]} |
{'a': 'b'} | Strings must use double quotes | {"a": "b"} |
{a: 1} | Property names must be in double quotes | {"a": 1} |
{"n": 007, "x": .5} | Leading zeros; number starts with a decimal point | {"n": 7, "x": 0.5} |
{"ok": True, "v": None} | Booleans and null are lowercase | {"ok": true, "v": null} |
// comment | Comments are not allowed in JSON | remove the comment |
The YAML problems it catches
YAML errors are mostly about whitespace: tabs used for indentation, a child key indented one space too far, or key:value without a space after the colon, which YAML reads as a single string. The validator reports these with the line number and adds warnings for values that YAML 1.1 parsers such as PyYAML read differently from YAML 1.2, for example country: NO becoming false or mode: 0755 becoming an octal number.
Privacy
The page is static HTML and JavaScript. Nothing you paste is transmitted, stored or logged, there is no account, and the tools keep working if you disconnect from the internet after the page has loaded.