Developer Tools

JSON Validator

Live

Validate strict JSON syntax with parser messages, error location, root type, and document statistics.

About JSON Validator

Check JSON syntax as you type or run validation on demand. A clear verdict identifies valid documents, while invalid input shows the native parser message and an approximate line and column when the browser reports an offset. For valid JSON, the result summarizes the root value type and number of top-level items. Built-in valid and broken samples make common rules—double quotes, no trailing commas, supported values, and balanced delimiters—easy to understand.

Set up JSON Validator

Workspace

Source workbench

Edit the source fields below and inspect the rendered output alongside your work.

Complete the fields to prepare a result.

Paste valid JSON text. Use double-quoted property names and string values.

JSON Validator: valid

Choose the values that apply, then validate.

Calculation method

Parse with JSON.parse; on failure, translate the parser offset into line and column; on success, inspect the root value.

How it works

Validation uses the browser’s strict JSON parser rather than JavaScript expression evaluation. If parsing succeeds, the tool reports the root type and top-level item count. If parsing fails and the parser supplies a character offset, the tool converts that offset into a one-based line and column. Syntax validity does not verify an application-specific schema.

Practical guide

Validate JSON syntax and surface the location of parsing errors before data is used elsewhere.

JSON Validator worked example

The page’s example models checking a pasted configuration or API payload. Change one assumption at a time so the effect on valid, node type and top level items remains easy to explain.

Treat the displayed valid, node type and top level items as the result of the example inputs, not as a default recommendation for a different situation.

Assumptions

  • The entered json describe the same scenario and use the units shown beside each field.
  • The calculation applies the stated method consistently and rounds only for display unless the tool says otherwise.

Limitations

  • Validation uses the browser’s strict JSON parser rather than JavaScript expression evaluation. If parsing succeeds, the tool reports the root type and top-level item count. If parsing fails and the parser supplies a character offset, the tool converts that offset into a one-based line and column. Syntax validity does not verify an application-specific schema.
  • The result covers the inputs exposed by this tool; omitted context can change a real-world answer.

Common mistakes

  • confusing valid JSON syntax with conformance to an application schema.
  • Changing json without checking the other assumptions can make the comparison misleading.
When to use JSON Validator
Approach Best for Trade-off
JSON Validator A transparent calculation that reports valid, node type and top level items. Accuracy depends on the entered assumptions and the documented method.
a JSON Schema validator that checks required fields and value constraints Situations that need different inputs, verification, or broader context. May take longer, cost more, or produce a result that is not directly comparable.

Examples

JSON Validator: Valid object

Example input
{
    "json": "{\n  \"name\": \"Ada\",\n  \"ok\": true\n}"
}
Expected result
{
    "valid": true,
    "node_type": "object",
    "top_level_items": 2
}

Privacy

This tool does not store your inputs or results on UtilityPages.org.

Citations & sources

  1. RFC 8259: The JavaScript Object Notation Data Interchange Format

Frequently asked questions

What syntax rules does the validator enforce?

It enforces standard JSON: double-quoted strings and property names, supported values only, commas between members, no comments or trailing commas, and balanced braces and brackets.

How is the error location calculated?

When the browser parser includes a character offset in its error message, the tool counts preceding line breaks and characters to estimate a one-based line and column. Browser error wording can vary.

Is valid JavaScript object syntax always valid JSON?

No. JSON does not allow comments, single quotes, unquoted keys, trailing commas, undefined, functions, NaN, or Infinity, even though some of those can appear in JavaScript.

Does a valid result prove the data matches my API schema?

No. It proves syntax only. You still need schema validation for required properties, data types, ranges, formats, and application-specific security rules.