ForHosting KIT · Web Scraping & Monitoring

Validate JSON syntax

Paste a data document and learn at once whether it can be read: a record for Ada with her roles passes, while a missing comma is reported with its line, column and position. Nothing is fixed or reformatted behind your back. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

The validator always returns a structured result: valid input produces a simple true flag, while invalid input produces false plus the parser message and the position, line, and column where parsing stopped.

One narrow question: can this exact text be read?

A syntax check answers a single question: would a standard reader accept this exact text as one complete document? That is why nothing is cleaned up first. Trimming spaces, swapping quotation marks, removing comments or adding a missing comma might make the text pass here and still fail later, in production, in a configuration file or in an upload form. When the answer is yes, you get a simple confirmation. When it is no, you get the reader's message plus the line, the column and the position where it stopped, so an editor or a form can take the person straight to the problem.

Reading the error location correctly

The reported spot is where the reader realised it could not continue, which is not always where the typo is. A missing comma between two entries is usually flagged at the opening quote of the second entry, because only there does it become clear that the first was not followed correctly. An unfinished group or list is reported at the very end of the text. The wording of the message can vary from one environment to another, so rely on the line and column to find the spot and treat the message as a hint for people.

Understand the reported error location

When parsing fails, the result includes an error object with a message and three coordinates. Position is a zero-based character offset from the beginning of the JavaScript string. Line and column are one-based, which makes them convenient to show in an editor or validation message.

Newline characters advance the line count and reset the column count. The location identifies where the parser detected that it could not continue; the actual typo may be just before that point. For example, a missing comma between two properties is often reported at the opening quote of the second property, because that is where the parser learns that the first property was not followed correctly.

An incomplete object or array is reported at the end of the text. Parser wording can vary across JavaScript runtimes, so integrations should use the numeric fields for navigation and show the message to humans rather than matching the full message as a permanent machine-readable category.

Give precise feedback in an editor

Use the returned offset, line, and column to guide a user toward the point where parsing failed.

Why is the error reported after the actual mistake?

The location marks where reading could no longer continue, and the real typo is often just before it. A missing comma between two entries is usually reported at the opening quote of the second one.

Are comments, single quotes or a trailing comma accepted?

No. Comments, text in single quotes, a dangling comma after the last item, extra content after the document and empty text are all rejected, because the standard format does not allow any of them.

Does the validator fix or reformat my text?

No. The text is checked exactly as you pasted it: nothing is trimmed, no quotes are replaced, no commas are added and no comments are removed, so an automatic cleanup never hides a defect.

Where do the line, column and position counts start?

Line and column start at 1, which matches what most editors show. Position starts at 0 and counts characters from the beginning of the text. Each line break moves to the next line and resets the column.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/web/json-validate

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/web/json-validate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"{\"name\":\"Ada\",\"active\":true}"}'
{
  "text": "{\"name\":\"Ada\",\"active\":true}"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "web.json_validate",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

timeout_sec30
max_crawl_pages25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Paste or send a JSON string to check whether its syntax is valid without changing, formatting, or repairing the source. That predictable response is useful in editors, upload forms, deployment checks, test suites, and any workflow that must explain a broken JSON document instead of crashing on it.

Check syntax without changing the document

An invalid result keeps the failure in the normal output rather than turning it into an exception. You can therefore display the answer immediately to a person or branch on the valid flag in code. A syntax validator should answer one narrow question: can a standards-compliant JSON parser read this exact string? This tool passes the supplied text directly to the platform JSON parser. It does not trim the source, replace quotation marks, remove comments, insert commas, reorder keys, or reinterpret values. That restraint matters when you are testing configuration or an API payload, because an automatic cleanup could hide the defect that will still fail in production. A valid result means the complete string was accepted as one JSON value, including objects, arrays, strings, numbers, booleans, and null. Empty text, trailing content, comments, single-quoted strings, dangling commas, and unescaped control characters remain invalid because they are not JSON syntax.

Use the result safely in forms and automated checks

In a browser form, run validation before submitting configuration and move the cursor to the returned position when valid is false. The algorithm is deterministic, performs no network calls, and uses no model, random value, clock, or persistent state. Its runtime grows linearly with the document size for ordinary parsing and location calculation. In an API pipeline, treat the response as data: continue only when valid is true, otherwise attach the line, column, and message to a build report, support ticket, or rejected upload. Malformed JSON is expected user content, so it receives a successful capability result with valid set to false instead of an invalid-input task failure. A request is rejected only when the required text field itself is absent or is not a string, since there would be no JSON source to inspect. API use costs $0.002 per request, while the browser version can perform the same check locally for quick interactive work.

Validate configuration before deployment

Stop a release when a JSON configuration file has a missing comma, unmatched bracket, invalid escape, or other parsing defect.

Reject malformed API payload samples

Check captured or generated JSON strings in tests without allowing a parser exception to interrupt the surrounding test runner.

What does the JSON syntax validator return?

Valid JSON returns an object with valid set to true. Invalid JSON returns valid set to false plus an error message, zero-based position, and one-based line and column.

Does it repair or format invalid JSON?

No. It validates the exact source string and reports the parsing failure without changing the document.

Are comments and trailing commas accepted?

No. Standard JSON does not allow comments or trailing commas, so the validator reports them as syntax errors.

Can a primitive value be valid JSON?

Yes. A JSON document may contain an object, array, string, number, boolean, or null as its top-level value.

How much does an API validation cost?

Each API request costs $0.002. The interactive browser tool can run the same deterministic validation locally.

Read the full KIT documentation →