Last updated ·Published ·By the WiserWork team
JSON Formatter
Beautify, minify, validate & tree-view your JSON data
Paste JSON and it reformats as you type, with a valid or invalid badge, a character count for both panes, and your browser's own parser error when something is wrong.
What is the JSON Formatter?
The JSON Formatter runs your text through the browser's native JSON.parse, then prints it back either indented with two spaces or squeezed onto one line. Because parsing and formatting are the same step, validation comes free: if beautified output appears, the document was legal JSON. The output pane is syntax-colored text rather than a collapsible tree, and the indent width is fixed at two spaces.
Key Features
- Beautify with a two-space indent, or minify to a single line
- Valid or invalid badge appears the moment parsing succeeds or fails
- Character counts for input and output show what minifying saved
- Keys, strings, numbers, booleans and null each get their own color
- Reformats live as you type, with no button press required
Common Use Cases
- Making a one-line API response readable enough to find the field you want
- Checking that a config file parses before a deploy fails on it
- Minifying a fixture file to see how much whitespace it was carrying
- Confirming a payload someone pasted into a ticket arrived intact
How to Use the JSON Formatter
- Paste or type your JSON into the left Input pane.
- Watch the right pane reformat as you type, indented two spaces.
- Check the toolbar badge for Valid JSON or Invalid JSON.
- Press Minify to collapse it, then compare the two character counts.
- Use Copy Output to take the result, or Clear to empty both panes.
Tips for Best Results
- When the badge says invalid, read the position in the error and count characters from the start.
- Minify before measuring payload size, but expect gzip to erase most of that saving in transit.
- Numbers past 9007199254740991 lose precision on the round trip, so keep long IDs as strings.
- Duplicate keys are accepted on the way in, but only the last one survives reformatting.
Why Use WiserWork's JSON Formatter?
Almost every JSON problem is one character in the wrong place, and the browser's parser already knows which one. This page simply puts that message in front of you alongside a readable version of the document, without shipping your payload anywhere or asking you to install a linter first.
Who Uses the JSON Formatter?
Anyone reading an API response by hand, ops people checking a config before it ships, and support staff who receive JSON pasted into a ticket and need to know whether it survived the trip. It is also the quickest tiebreaker when an editor plugin and a build tool disagree.
Frequently Asked Questions
What actually makes JSON invalid?
The usual culprits are a trailing comma after the last item, single quotes instead of double, and unquoted keys. Comments break it too, because JSON has no comment syntax at all, which catches out people arriving from JavaScript.
Does it validate, or only format?
Both, in the same operation. Formatting requires a successful parse, so beautified output is itself proof the document is valid and the badge just reports the verdict.
Does it tell me where the error is?
It prints the browser's parser message verbatim, which normally includes a position. Firefox reports a line and column, Chrome and Safari report a character offset, so the wording depends on the browser you are in.
Can I change the indent to four spaces or tabs?
No, beautify is fixed at two spaces. Reindent in your editor afterwards if your project uses something wider.
Is my JSON sent anywhere?
No. JSON.parse and JSON.stringify are browser built-ins, so the text never leaves the page and nothing is posted to a server.
Why did the key order change?
Reformatting rebuilds the object, and JavaScript lists integer-like keys first in ascending numeric order. Ordinary string keys keep exactly the order you supplied.
Will it accept JSON with comments or trailing commas?
No, and that is the correct behavior. JSONC, JSON5 and similar dialects are not JSON, so strip the extras first or reach for a parser built for those flavors.
Is there a collapsible tree view?
Not at the moment. The output is syntax-colored text you can scroll and copy, which covers most reading, but it will not fold a deeply nested object out of the way.
Why does my very large number come back different?
JavaScript parses every JSON number as a double, so integers above roughly nine quadrillion get rounded. Long identifiers should be quoted as strings in the payload itself.
How large a document can it handle?
No limit is coded in, but the work happens on the main thread, so a document of several megabytes will make the page stutter as it reformats on each keystroke.
JSON is a small specification with sharp edges, and most days you only need to know which character broke it. Parse, glance at the badge, read the position, fix the comma, move on.