TheDevTab
Tools

Keyboard shortcuts

Ctrl K
Search tools and guides
?
Show keyboard shortcuts
Escape
Close menus and dialogs

Guide

How to format and validate JSON

By TheDevTab team ยท Updated 14 August 2026

Start with valid JSON

Formatting is the step that makes a JSON document easier to read, but parsing comes first. A parser needs a complete object or array, double-quoted strings, valid numbers, and the correct closing brackets. JSON is stricter than a JavaScript object literal. Comments are not part of standard JSON, and a comma after the last property is invalid.

A small example is enough to show the distinction. The textname: "Ada" is useful inside a discussion, but it is not a complete JSON document. A complete document would need an object, quoted key, quoted value, and no trailing comma. If a parser reports an error near the end, check the character immediately before the reported position. The real mistake is often an earlier missing quote or bracket.

TheDevTab's JSON Formatter parses pasted text in the browser. It keeps your input visible, reports a line and column when possible, and does not send the document to a server.

Formatter, beautifier, and validator

Formatter and beautifier usually mean the same operation: take valid JSON and write it with consistent indentation. Indentation is for humans. It does not add missing fields, correct types, or check whether an API will accept the document.

A validator answers a narrower question: is this text legal JSON? A schema validator answers a different question: does this valid JSON match a specific contract? The second question needs a schema and rules such as required properties, allowed values, and minimum lengths. A formatter can be useful before schema validation because the readable output makes the document easier to inspect, but formatting alone is not schema validation.

Minifying reverses the presentation choice. It removes whitespace that is not part of a string, which can reduce the size of a request or fixture. It does not make the data private. Sorting keys can make two documents easier to compare, but key order may be meaningful to a human review, so use it deliberately.

Fix the common failures

Trailing commas are the most frequent error when JSON was copied from JavaScript or a config file. Remove the comma after the final property and the final array item. Replace single quotes with double quotes, and remove comments unless the receiving system explicitly supports a JSON-like format. Check that control characters inside strings are escaped and that every opening brace or bracket has a matching close.

Repeated keys deserve a separate warning. Many browser parsers, includingJSON.parse, keep the last value and discard the earlier value. The resulting document can be syntactically valid while still hiding a data mistake. If duplicate keys matter, use a parser that reports them instead of assuming a normal formatter will catch them.

When a large pasted value is hard to review, format it first, then use a focused search in your editor for the property named in the error or the API response. Do not paste secrets into a public ticket just because the output is now easier to read.

A practical local workflow

  1. Paste the smallest complete document that reproduces the problem.
  2. Run Validate or Format and read the first reported line and column.
  3. Fix syntax, then format with the indentation used by your project.
  4. Use Minify only when a compact representation is actually needed.
  5. Run the result through the API or schema checks that own the contract.

For two documents, format both before opening JSON Diff. Parsing removes insignificant whitespace, so the comparison can focus on keys and values. For a list of objects that needs a table, use JSON to CSV after you have checked the shape of the data.

Know the browser limit

A browser can process substantial JSON locally, and larger files can use a Web Worker to keep the page more responsive. That does not remove the memory limit. A very large document may take time to parse, require a tab with enough free memory, or need to be split into smaller files. The worker is still local and does not upload the file.

A valid document is only a syntactic success. It may contain a secret, an incorrect identifier, or a value that violates an application rule. Treat the formatted result as a clearer view of the same data. Format and validate JSON in the browser when you are ready to try the workflow.