TapCub is live — analytics, insights and live chat, free on one platform

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
Formatter

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.

Valid JSON.

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.

Formatted JSON
{
  "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
      }
    ]
  }
}
Runs entirely in your browser. Nothing you type here is uploaded or stored by TapCub.

Version v1.0Updated Update history

Read the result

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.

How to use it

Three steps

Nothing to install and nothing to click to run.

  1. 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. 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. 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.

Syntax rules

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
Strict JSON syntax: accepted and rejected forms
RuleAcceptedRejected
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 decimals199, -0.5, 1.5e30199, 0x1F, +1, NaN
Only JSON literalstrue, nullTrue, None, undefined
Control characters are escaped"line 1\nline 2"A real line break inside quotes
Worked example

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.

Size of the same JSON event with different indentation
LayoutLinesSize (bytes)Compared with minified
2 spaces20293+55%
4 spaces20365+93%
Tabs20257+36%
Minified1189—

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.

Common mistakes

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.

FAQ

JSON 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.

Changelog

Update history

New features, fixes and data refreshes for this tool, newest first.

  1. · 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

Next step

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.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics