Free tool JSON formatter and validator
Paste an API response, an event payload or a config file. The formatter checks it against strict JSON, lays it out with the indentation you choose, and when something is wrong it tells you the line and column where parsing stopped.
- Strict JSON validation
- Updates as you type
- Runs locally
Format, minify or check JSON
The sample is a purchase event as an analytics SDK might send it. Replace it with your own JSON; the result and the counts update as you type.
Strict JSON only: double quotes, no comments, no trailing commas.
Keys
13
Object keys at every level. Array items are not keys.
Nesting depth
4
Levels of objects and arrays. A bare value is 0.
Size (bytes)
293
UTF-8 size of the formatted result below.
{
"event": "order_paid",
"time": 1794297600,
"user": {
"id": "u_1024",
"plan": "pro"
},
"properties": {
"order_id": "A8841",
"amount": 199,
"currency": "USD",
"coupon": null,
"items": [
{
"sku": "PRO-12",
"qty": 1
}
]
}
}Version v1.0Updated Update history
What the formatter tells you
Beyond the formatted text, you get a verdict and three counts. Each answers a different question about the data.
Valid, or line and column
Valid means a strict JSON parser accepts the text as it is. On an error, the position is where the parser gave up. A missing comma is usually reported at the start of the next key, so look at that spot and the character just before it.
Keys
Every key in every object, nested ones included. The sample has 13: four at the top, two under user, five under properties and two in the item. Array elements are values, not keys, so a list of 100 numbers adds nothing.
Nesting depth
How many objects and arrays sit inside each other on the deepest path. The sample is 4 deep: the root object → properties → items → the item inside it. Deep nesting makes payloads harder to query; many analytics tools flatten event properties to one or two levels.
Size in bytes
The UTF-8 byte length of the output, so it changes with the indentation you pick. Non-ASCII text counts 2–4 bytes per character. Use the minified size when checking a request against a size limit.
The formatter re-serialises the parsed data, so equivalent values are written in their shortest form: 1.50 becomes 1.5, 1e3 becomes 1000 and \u00e9 becomes é. The data is the same; the text is not byte-for-byte identical.
Three steps
Nothing to install and nothing to click to run.
-
1
Paste the JSON
Copy it from a network tab, a log line, an API client or a file. Leading and trailing whitespace is fine.
-
2
Choose the layout
Two spaces is the common default for reading; four spaces or tabs follow your codebase; minify for a request body or an environment variable. Sort keys when you want to compare two payloads.
-
3
Fix or copy
If there is an error, jump to the reported line and column and fix it there. When it says valid, copy the result with the button on the code block.
What strict JSON allows
JSON (RFC 8259) is a small subset of JavaScript object syntax. Most "invalid JSON" errors come from writing JavaScript, Python or YAML habits into a JSON file.
- Six value types only: string, number, object, array,
true/false,null - Dates have no type of their own: send an ISO 8601 string or a Unix timestamp
- Whitespace between tokens is free, which is why formatting never changes the data
| Rule | Accepted | Rejected |
|---|---|---|
| Keys are double-quoted strings | {"plan": "pro"} | {plan: "pro"} |
| Strings use double quotes | "pro" | 'pro', “pro” |
| No trailing commas | [1, 2] | [1, 2,] |
| No comments | — | // note, /* note */ |
| Numbers are plain decimals | 199, -0.5, 1.5e3 | 0199, 0x1F, +1, NaN |
| Only JSON literals | true, null | True, None, undefined |
| Control characters are escaped | "line 1\nline 2" | A real line break inside quotes |
One event, four layouts
The sample purchase event (13 keys, 4 levels deep) formatted each way. The data never changes; only the whitespace and the byte count do.
| Layout | Lines | Size (bytes) | Compared with minified |
|---|---|---|---|
| 2 spaces | 20 | 293 | +55% |
| 4 spaces | 20 | 365 | +93% |
| Tabs | 20 | 257 | +36% |
| Minified | 1 | 189 | — |
Indentation adds a third to almost double the raw size of this payload. Over HTTP with gzip or Brotli the gap is much smaller, because repeated spaces compress well, but limits on request bodies, headers and log lines usually count raw bytes.
Why JSON fails to parse
The same handful of errors cause most failures. The reported column usually lands right on them.
JavaScript instead of JSON
Unquoted keys, single quotes, trailing commas and comments work in a JS object or a JSON5 config, but a strict parser rejects them.
Curly quotes from a document
JSON pasted through a word processor or a chat app often gets “smart” quotes. They look right and fail at the first key.
Long IDs as numbers
Integers above 9,007,199,254,740,991 lose precision in JavaScript, here included. Send 64-bit IDs and order numbers as strings.
JSON inside a string
A payload stored as an escaped string, such as "{\"a\":1}", is valid but formats as one string. Copy the inner text without the outer quotes and escapes.
Event data with a schema that stays clean
Events sent to TapCub carry their properties as JSON, from the web script, the app and mini-program SDKs, or the server API. Each event is checked on arrival so a wrong type or a missing property does not quietly skew a report.
Custom events and properties
Track orders, sign-ups or any business action with the fields you care about, then chart and filter by them.
Learn moreSDKs and server API
Seven platform SDKs plus a server API with a Server Key, all sending into one project with shared event names.
Learn moreData-quality checks
Unexpected event names, missing properties and wrong types are flagged; duplicates can be merged or renamed.
Learn moreJSON formatter questions
Still have a question?
Chat with the team behind TapCub — we usually reply within a few hours on business days.
What does a JSON formatter do?
It parses JSON text and writes it back out in a consistent layout: one key per line with indentation for reading, or a single line with no extra whitespace for sending. Because it has to parse the text first, it also works as a validator.
How do I check whether my JSON is valid?
Paste it into the box. "Valid JSON" means a strict parser accepts it. Otherwise you get the line and column where parsing stopped; the problem is at that character or just before it, typically a missing comma, an extra comma or a stray quote.
Why is my JSON invalid when it works in JavaScript?
A JavaScript object literal allows unquoted keys, single quotes, trailing commas and comments, and values that only exist in JavaScript. JSON allows none of these. Config formats such as JSON5 and JSONC relax some rules, but APIs and JSON.parse expect strict JSON.
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation so people can read it; minifying removes every optional space so the payload is smaller. Both contain exactly the same data. In the example above, minifying cut the event from 293 to 189 bytes.
Why did a large number change after formatting?
Like most JavaScript-based tools, the formatter stores numbers as 64-bit floats, which are exact only up to 9,007,199,254,740,991. A 19-digit ID comes back rounded. Keep such IDs as strings in the JSON you send.
Why did the key order change?
With sorting off, keys keep their order with one exception from the JavaScript engine: keys that look like non-negative integers, such as "2" or "10", move to the front in numeric order. JSON objects are unordered by definition, so parsers should not depend on key order.
Does the formatter change my values?
No, but it writes them in normal form: 1.50 becomes 1.5, escapes like \u00e9 become the character itself, and if a key appears twice only the last value is kept. Watch for that last one: duplicate keys are a common source of silent bugs.
Is my JSON uploaded anywhere?
No. Parsing and formatting happen in your browser and nothing is sent to TapCub. This tool also has no share link, so pasted JSON never ends up in a URL. It is still wise to remove tokens and personal data before pasting payloads into any online tool.
Update history
New features, fixes and data refreshes for this tool, newest first.
-
· v1.0
LaunchedFirst release.
Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates
Send events your reports can trust
Connect your site or app and the event names and properties you send show up as filters, breakdowns and funnel steps, with type checks on arrival.