Snipget.ai

Validate JSON and locate errors

Exact
json_validate

Deterministic and authoritative — the canonical answer for this input.

Validate whether a string is well-formed JSON. On failure returns the error message plus its exact line, column, and character offset — so an agent can locate and fix a malformed document. Processing multiple inputs? Use `json_validate_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

The JSON text to validate.

Call it

curl -X POST https://api.snipget.ai/v1/json/validate \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"{\"name\": \"Ada\", \"age\": 36}"}'

The Batch tab sends up to 1000 inputs in one call via /v1/json/validate/batch.

Example response

{
  "input": "{\"name\": \"Ada\", \"age\": 36}",
  "is_valid": true,
  "type": "object",
  "size": 2
}

FAQ

Why not just trust a model to tell me if JSON is valid?

Language models routinely call broken JSON valid, or cannot say where it broke. This is a real parser, so the verdict is exact and authoritative, and on failure it points at the precise line, column, and character where the problem starts.

What do I get when it is valid?

A clear yes, plus the top-level type, such as object or array, and its size, meaning the number of keys or items at the top level.

What does an invalid result look like?

is_valid comes back false with confidence 0, the parser's error message, and the error's line, column, and character position so you can jump straight to the problem.

Does invalid JSON cause an error response?

No. Bad input is a normal, successful answer of 'no, this is not valid' with confidence 0. You will not get an HTTP error page for malformed JSON.

Does it check my data against a schema?

No. It only checks that the text is well-formed JSON. It does not verify required fields, types, or any schema rules.

Related tools