The request goes out, and the API answers with a 400 and a message that tells you almost nothing. Somewhere in a body you assembled from three code paths and a template string, there is a trailing comma or a missing one, and the endpoint will not tell you where. You end up reading raw JSON character by character, which is the slowest possible way to find a punctuation error.

There is a cheaper order of operations: check the body before it leaves your machine. This guide walks through a pre-flight validation habit using the free JSON Formatter and Validator on Ovatly, and it is honest about the boundary of what such a check can promise.

Contents

  • Quick answer
  • What "valid" actually means
  • The errors a pre-flight check catches
  • Syntax is not schema
  • How to validate a request body, step by step
  • Worked example: a trailing comma caught in time
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

Before sending, paste the exact request body into the JSON Formatter and Validator and use Validate only. If the JSON is broken, the tool names the problem in plain words, an unexpected character or a missing comma, so you fix that spot and validate again. When it passes, send the body as it is. One boundary to keep in mind: this checks syntax only. It cannot check the API's schema, so valid JSON with a missing required field will still fail at the endpoint.

What "valid" actually means

Valid JSON is JSON a parser can read without guessing. The grammar is strict and small: keys are double-quoted strings, strings use double quotes, items are separated by commas with no comma after the last one, and the brackets all match. There is no room for comments, and there are no exceptions for text that looks almost right.

That strictness is why hand-assembled bodies break so often. A template that joins fields with commas produces a trailing comma when the last field is empty. A value copied out of a Python or JavaScript file arrives with single quotes. A note you wrote to yourself in the payload is a comment, and JSON does not allow comments. None of these look wrong at a glance, and every one of them is a parse failure at the other end.

The errors a pre-flight check catches

The validator checks your text against that strict grammar and, when it fails, names the problem instead of returning a bare "invalid". The regular offenders are:

  • A trailing comma after the last item in an object or array, usually left behind by a template or a deleted field.
  • Single-quoted strings, which JSON does not accept at all.
  • Unquoted keys, common when a body was typed as if it were a JavaScript object literal.
  • Comments, which belong to formats like JSONC; this validator follows the strict standard, so commented JSON fails here just as it would at a strict endpoint.
  • A missing comma between two items, or an unexpected character that slipped in during an edit.

Each of these is a one-spot fix once you know where it is. The value of the check is not the verdict, it is the named location of the problem.

Syntax is not schema

This is the honest limit, and it shapes how much trust to put in a green result. Validation answers one question: can this text be parsed as JSON? The API asks a second question the moment parsing succeeds: does this body contain what this endpoint requires, in the shape it requires?

A body can be perfectly valid and still be rejected because a required field is missing, a value is the wrong type for that field, or a name is spelled differently from the endpoint's documentation. No tool on this page can know that endpoint's rules, and this guide will not pretend otherwise. Treat validation as the check that removes punctuation from your list of suspects. When a validated body still fails, the problem is in the contract with the API, and the documentation, not the validator, is where to look.

How to validate a request body, step by step

  1. Open the JSON Formatter and Validator and paste the exact body you are about to send, copied from the same place the request will be built: the file, the template output, or the debugger. Do not retype it or tidy it first.
  2. Choose Validate only. This checks the text without changing it, so the thing you verified is byte for byte the thing you send.
  3. If it fails, read the error, fix the one problem it names, and validate again. Work through errors one at a time rather than editing several spots at once.
  4. When it passes, send the body unchanged. If you later edit the body, validate again: the pass belonged to the earlier text.

Worked example: a trailing comma caught in time

Suppose a small body is assembled by a script that appends a comma after every field, including the last:

{"name":"Ovatly","tools":250,"free":true,}

That final comma makes the whole body invalid, and many APIs would reject it with a generic error. Pasted into the validator, it fails, and the error points at the unexpected character near the end. Remove the one comma:

{"name":"Ovatly","tools":250,"free":true}

Now it validates. For contrast, formatting the same valid body shows the structure the parser sees:

{
  "name": "Ovatly",
  "tools": 250,
  "free": true
}

The whole exchange takes seconds, and it happens on your side of the network, where the fix is free.

Limitations and honest tradeoffs

Validation is a syntax check, full stop. It says nothing about whether the values are sensible, whether the fields match the endpoint's schema, or whether the API will accept the request for business reasons. A pass is the absence of parse errors, not a promise of a 200 response.

Validate only leaves your text untouched, which is what you want before sending. Be aware that the neighbouring operations are different: formatting parses and rewrites the JSON, and number handling follows JavaScript, so integers beyond 2^53 can lose exactness when text is parsed and written back. If a body carries very large identifiers as numbers, validate rather than reformat it. Very large pastes, in the tens of megabytes, may also take a moment to check. The tool runs fully locally in your browser and uploads nothing, which makes it safe for bodies containing credentials or personal data.

Common mistakes

  • Validating a tidier copy. You fix the copy, send the original, and the error ships anyway. Always validate the exact text that will be sent.
  • Formatting instead of validating. Format rewrites the body, so you end up sending different text from the one you checked. Use Validate only for the pre-flight pass.
  • Reading a pass as a schema guarantee. Valid JSON with a missing required field still fails. The pass only clears syntax.
  • Fixing three guesses at once. Change one named error, re-validate, and let the next error surface. Shotgun edits create new ones.
  • Skipping the check after a "small" edit. Small edits are exactly where commas get lost. The check is cheap; run it again.

FAQs

Does validation check that my JSON has all the fields the API requires? No. Validation checks syntax only: brackets, commas, quotes and structure. Whether a required field is present is the API's schema, and no tool here can know that endpoint's rules. A body can pass validation and still be rejected for a missing field.

What is the difference between Validate only and Format? Validate only checks the text and leaves it exactly as it is. Format rewrites it with indentation, which helps reading but changes the text. For a pre-flight check, Validate only is the safer choice, because what you checked is exactly what you send.

Which mistakes does the check catch most often? Trailing commas after the last item, single-quoted strings, unquoted keys, comments pasted in from a config file, and a missing comma between two items. The error names the problem, so you fix that spot rather than rereading the whole body.

Is my request body uploaded anywhere? No. The check runs locally in your browser and nothing is uploaded, which matters when a request body contains keys, tokens or customer data you would rather keep on your own machine.

Can validating change my numbers? Validate only does not reformat your text, so nothing changes. Precision only becomes a question when JSON is parsed and rewritten: number handling follows JavaScript, and integers beyond 2^53 can lose exactness in that process. A validation pass avoids it entirely.

Conclusion

A pre-flight validation pass turns the vaguest class of API failure, the unparseable body, into a named, fixable error on your own machine. Paste the exact body into the JSON Formatter and Validator, fix what the error names, and send it unchanged, while remembering that syntax is only the first gate and the endpoint's schema is the second. When the problem is the opposite one, a valid response you cannot make sense of, our companion guide on reading nested JSON without getting lost covers the reading technique. More guides in this series live in the Data and JSON Tools guides.

References