Format and syntax-check JSON
Paste the current JSON, confirm that it is valid Strict JSON, then format it or compress it to one line.
Open JSON formatting/compression/syntax checking toolConclusion: Start at the first error position and inspect back to the preceding token
The current tool's custom parser converts the error index to a line and column and displays an excerpt of the relevant line and ^. "Move to error location" selects the characters in the input field.
With a missing comma, parsing may stop at the next key; with a missing brace, it may stop at the end of the input. Check not only the displayed character but also the preceding value, comma, quote, brace, and bracket.
Common errors and where to check
| Error candidates | Check points | Fix strategy |
|---|---|---|
| Missing comma | Between the previous value and the next key | Add one between members |
| Trailing comma | Immediately before } or ] | Remove only the final comma |
| Missing braces or brackets | Input ending and nesting | Check the matching closing symbol |
| Missing Quote | String start and end | Match double quotes |
| Invalid Escape | Immediately after a backslash | Correct it to an escape allowed in JSON |
| Missing colon | Immediately after the Object Key | Place : between the key and value |
How to fix without increasing errors
- Duplicate the original JSON.
- Check the first Error location and the immediately preceding Token.
- Fix only one location and check syntax.
- If the following error occurs, repeat the same sequence.
- Format it after it becomes Valid, then recheck the bracket hierarchy.
What can be checked with DevelopTools' JSON formatter
The current tool parses pasted JSON or one .json file with its own strict JSON parser. It supports formatting, minifying to one line, and syntax checking. On errors, it displays the line and column, an excerpt of the relevant line, a caret, and a button to move to the location in the input.
| Function | Support in the current Tool |
|---|---|
| Input | Paste, select a .json file, drag & drop one file |
| plastic surgery | 2, 4, or 8 spaces or tabs; LF or CRLF; and a trailing newline |
| verification | Strict JSON, line and column, excerpt and caret, duplicate key warnings |
| output | Copying, UTF-8 JSON saving, file naming, and input/output size |
| Preserve | Large integers, exponential notation, escaped string tokens, and duplicate keys |
| Unsupported | JSONC / JSON5, automatic repair, comment removal, quote repair, key sorting, and unescaping |
Even when an Error is found, the content is not repaired automatically. Check the cause, correct the input, and run "Syntax Check" again. Even if the root is not an Object, Array, String, Number, true, false, and null can be validated as JSON Text.
Common procedure for validating as Strict JSON
Based on RFC 8259, enclose Object Names and Strings in Double Quotes, and place Commas only between Members or Array elements. Comments, Single Quotes, Unquoted Keys, and Trailing Commas are not standard JSON.
First, enter the original data without modifying it and use Syntax check to identify the first error location. Fix the area around the error one location at a time and check again; format or minify only after it is valid. Bulk-replacing multiple locations based on guesses risks changing symbols inside strings.
- Paste JSON or load one .json file.
- Run syntax checking and check the location indicated by the line, column, and caret.
- Compare with the original specification, fix one location, and check again.
- After it becomes Valid, choose indentation, line endings, and a trailing newline.
- Recheck the output, then copy it or save it as JSON under a different name.
Syntax checking confirms that it can be read as JSON. Validate business structure, such as required Properties, value types, and ranges, separately with JSON Schema.
Do not confuse formatting, minification, validation, and repair
| processing | purpose | Effect on data |
|---|---|---|
| syntax check | Check whether it can be parsed as Strict JSON | Do not modify the input |
| Format / Pretty Print | Use line breaks and Indent to make the hierarchy easier to read | Change formatting whitespace |
| Compression / Minify | Convert to one line by removing formatting whitespace | Separate from gzip and Brotli |
| Automatic repair | Infer and fix broken syntax | Not supported by the current Tool |
| Schema validation | Check Properties, types, and constraints | Role of the JSON Schema Validation Tool |
Formatting or minification cannot be applied to Invalid JSON. Fix the syntax first, then verify that the converted JSON can also be parsed again.
Notes for handling confidential and large JSON
Input JSON, selected files, and processing results are parsed in the browser and are not sent to the DevelopTools server or external APIs. LocalStorage stores only display settings such as indentation, theme, font, and editor size; it does not store input content or processing history.
Processing is separated from the UI thread by prioritizing Web Workers. Syntax highlighting in the editor is omitted for more than 500,000 characters, but formatting, minification, and validation continue. Because all text, syntax trees, and output are retained in memory, the processable size depends on device and browser memory.
- Mask API keys, access tokens, cookies, and personal information before sharing.
- Try large files incrementally using copies, and close other heavy tabs
- Even if color coding disappears, check the error display and conversion result
- Do not overwrite the original file; save under a different name and compare differences
Primary sources for JSON specifications and commands
Check JSON grammar against RFC 8259, JavaScript APIs against MDN, JSONC against official Visual Studio Code documentation, and jq options against the official jq Manual. JSON.parse error text differs by runtime, so treat “Unexpected token” in the article as a representative term.
Example: Fix JSON with a missing closing curly brace
Use input where an object is not closed, such as {"name":"Alice","age":20. Preserve the original data before working, and if it contains sensitive values, verify it using a copy intended for sharing.
Compare the input-ending error with the start of the object and add }. Finally, verify valid syntax, the two keys, number values, and that there are no extra trailing characters, then confirm again that the error is gone.
- Enter the target JSON and run a syntax check first.
- Check the character indicated by the line, column, and caret together with the surrounding structure.
- Fix one cause and check again.
- After it becomes Valid, format or minify it as needed.
- Save the result under a different name and verify that it can be loaded at its destination.
Keeping the JSON from before and after the fix lets you use a text diff to check for value changes beyond the intended syntax correction.
Frequently asked questions
- Is the JSON I enter sent to the server?
- It is not sent. Input, file loading, parsing, formatting, minification, copying, and saving are processed in the browser. Only display settings remain in LocalStorage.
- Can syntax errors be repaired automatically?
- No. The user corrects input using the row, column, and relevant location as clues, then checks syntax again. Its role is separate from guess-based automatic repair.