Validate JSON syntax
Paste or send a JSON string to check whether its syntax is valid without changing, formatting, or repairing the source.
Run — free
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. 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
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. 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. Empty text, trailing content, comments, single-quoted strings, dangling commas, and unescaped control characters remain invalid because they are not JSON syntax.
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.
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. 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. 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. API use costs $0.002 per request, while the browser version can perform the same check locally for quick interactive work.
What you can do with it
Validate configuration before deployment
Stop a release when a JSON configuration file has a missing comma, unmatched bracket, invalid escape, or other parsing defect.
Give precise feedback in an editor
Use the returned offset, line, and column to guide a user toward the point where parsing failed.
Reject malformed API payload samples
Check captured or generated JSON strings in tests without allowing a parser exception to interrupt the surrounding test runner.
FAQ
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.
For developers — API access
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.
API endpoint
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.
Call it from your stack
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}"}'const res = await fetch("https://api.kit.forhosting.com/web/json-validate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "{\"name\":\"Ada\",\"active\":true}"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/web/json-validate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "{\"name\":\"Ada\",\"active\":true}"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/web/json-validate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"{\\"name\\":\\"Ada\\",\\"active\\":true}"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"{\"name\":\"Ada\",\"active\":true}"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/web/json-validate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "{\"name\":\"Ada\",\"active\":true}"
}Example response
{
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
timeout_sec | 30 |
max_crawl_pages | 25 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |