Everyone uses an online JSON formatter, and every one of them receives whatever you paste — which is frequently an API response containing real customer data. Built client-side, that problem disappears.

1. Format, and explain the failure

Formatting valid JSON is one function call. The actual product is what happens when it's invalid.

json-tool.txt
Build a browser-only JSON formatter. No server, no upload.

- Format with configurable indentation, and a minify option.
- On a parse error: show the line and column, highlight it in the
  input, and explain the problem in plain English — "trailing comma
  on line 14", not "unexpected token".
- Handle the common real-world causes: trailing commas, single quotes,
  unquoted keys, comments, and a BOM at the start.
- Collapsible tree view alongside the raw text.
- Handle a 10MB paste without freezing the tab.

State on the page that nothing is uploaded.

2. The error messages are the feature

The browser's native parse error is nearly useless. Catching the position and showing the actual line with a marker under it turns a frustrating tool into the one people keep open.

Bonus: offer to fix the common problems. A "this has trailing commas, fix them?" button saves real time.

3. Don't freeze on big input

A 10MB paste formatted on the main thread locks the tab. Move parsing to a worker for anything large, and show progress.

The tree view is worse — rendering 50,000 nodes at once will kill it. Render lazily, expanding only what's opened.

4. Useful extras

A JSONPath or query box for pulling values out. A diff between two documents. Conversion to CSV or YAML. Each is small and each is a reason someone chooses yours.

Add a permalink that encodes the content in the URL fragment. Fragments are never sent to a server, so it stays private while still being shareable.