DevKit
Tester

JSON Payload Validator

Validate a JSON payload and see size, key count, and nesting depth.

Last updated: August 2026

Share:

Was this tool helpful?

Measuring a payload, not just parsing it

Beyond "is this valid JSON," you often need to know how big and how deep a payload is. This tool parses the input and reports metrics: total byte size, number of keys, and maximum nesting depth. Those numbers matter when a payload is about to cross a limit you care about.

Why size and depth are not academic

API gateways cap request bodies (commonly a few megabytes), message queues cap individual messages, and some databases cap document size. Nesting depth matters too: many parsers refuse documents deeper than a set limit to prevent stack-exhaustion attacks, so a deeply nested payload can be rejected even when it is small. Key count hints at serialization cost and at payloads that have grown unwieldy.

Example

Input:
{ "a": { "b": { "c": [1, 2, 3] } } }

Size:        36 bytes
Keys:        3
Max depth:   4   (object > object > object > array)

Depth counts each level of nesting, so three nested objects plus the array inside reach a depth of four.

Byte size versus character count

A common slip: size in bytes is not the same as the number of characters when the content includes non-ASCII text. A single emoji or accented letter is one character but several UTF-8 bytes, so a payload can be under your character budget yet over the byte limit the gateway enforces. Always measure the bytes you actually send.

FAQ

Does whitespace count toward size? Yes, if you send formatted JSON. Minify before measuring if the wire payload will be compact.

What counts as one key? Each key in each object, including nested ones. Array elements are not keys, which is why a long array can be large yet have a low key count.