Skip to content
brownie.tools

JSON Validator

Check JSON as you type, locate syntax errors, and inspect duplicate keys, key counts and nesting depth.

Runs locally in your browser. Nothing is uploaded or sent to a server.

Paste JSON into JSON Input or click Upload to check syntax automatically and see Valid JSON or Invalid JSON. Successful checks show the root type, total object keys and nesting depth, plus Items for a root array. Errors include line and column details when located; click the error to select its line. Duplicate keys trigger a separate warning. Validation runs in your browser, with Copy JSON and Copy Stats available after a successful check.

Updated

How do you validate JSON and read a real result?

Paste text into JSON Input or click Upload to read a local JSON file. There is no separate Validate button: the result updates as you type. A successful check displays Valid JSON with Type, Keys and Depth. Invalid JSON displays a Syntax Error message instead. Use Sample to explore the interface before checking your own payload.

For a worked example, paste this small API response. It contains a root object, an array of two objects and a boolean flag:

{"orders":[{"id":101,"total":24.5},{"id":102,"total":18}],"paid":true}
Validation statistics for the orders response
ResultDisplayed valueReason
TypeobjectThe outer value uses braces.
Keys6Two root properties plus two properties in each order.
Depth3Root object, orders array, then each order object.
ItemsNot shownOnly a root array receives this statistic.

Copy Stats produces Type: object · Keys: 6 · Depth: 3. Copy JSON copies the original input with surrounding whitespace removed; it does not indent, sort or reserialize the document. Keeping those actions separate lets you check a payload without automatically rewriting its presentation.

Why does JSON validation matter before using a payload?

JSON, defined by RFC 8259, represents data using objects, arrays, strings, numbers, booleans and null. Its punctuation is part of the format: a missing colon or closing bracket prevents parsing. Checking a manually edited configuration or copied API response helps distinguish a syntax problem from a problem in the application consuming it.

A valid result has a narrower meaning than an approved configuration. This validator does not know which properties your application requires, whether a total is correct, or whether an account exists. It checks syntax and reports structure. An API may still reject valid JSON because a field is missing or has the wrong type. Review the receiving application's contract separately.

How are syntax errors located and corrected?

The tool trims the input and calls the browser's native JSON.parse(). If parsing or structural analysis throws an error, a separate scanner attempts to locate a syntax issue in the original text. It supplies a descriptive message and line and column numbers when possible; otherwise, the underlying error message is shown. It reports one issue at a time rather than listing every error.

Click the error details when a location appears. The editor receives focus and selects the affected line, making a missing separator easier to inspect in context. Correct that issue and let the automatic check run again. Empty or whitespace-only input shows the invitation to paste or upload JSON, rather than a successful result.

Which JavaScript expressions are invalid JSON?

JSON requires double quotes around property names and string values. Unquoted keys, single-quoted strings, comments and trailing commas are rejected. Values such as undefined, NaN and Infinity are not JSON literals. Use lowercase true, false and null. These restrictions follow the JSON grammar in RFC 8259, rather than the more permissive syntax of JavaScript object literals.

Inside a string, write an escaped newline as \n rather than inserting a literal line break. The scanner also identifies invalid escapes and Unicode escapes without four hexadecimal digits. Outside strings, normal spaces, tabs and line breaks separate tokens. The validator applies JavaScript trimming before parsing, so its treatment of surrounding whitespace should not be used as an encoding conformance test.

What do nesting depth and duplicate-key warnings tell you?

Depth counts object and array containers along the deepest branch. A primitive root has no container and reports zero. An empty object or array still counts as one level. Keys counts object properties throughout the parsed structure, including objects nested in arrays. Array positions do not count as keys; Items describes only the length of a root array.

Duplicate-key detection scans the input separately and tracks names within each object. Reusing a name in separate objects is different from repeating it inside the same object. A warning can coexist with Valid JSON because the native parser accepts repeated properties and retains the last value. Statistics describe that parsed result, so they do not count every repeated property occurrence in the original text.

What can Auto-fix change, and what should you review?

When Auto-fix is enabled, it attempts to remove line and block comments, convert single-quoted strings, and remove commas immediately before closing braces or brackets. It replaces the editor contents, which triggers another validation. An enabled button does not guarantee a fully repaired document: some transformations leave another error that needs manual correction.

Keep your original text before applying a repair. Comment removal uses regular-expression replacements rather than a string-aware parser, so text resembling a comment inside a quoted value can be removed too. Automatic repair is a convenience for inspecting malformed input, not a guarantee that the intended values survive unchanged. Fix in Formatter offers another editing route; it does not certify the data.

Where does the JSON go when you copy, share or format it?

The validation path reads and checks JSON in your browser without uploading the payload. Open in Formatter → and Fix in Formatter attempt to store the input as a localStorage draft before navigating to the JSON Formatter. Browser storage failure does not stop navigation, so the formatter may open without the draft.

Copy Link is offered for valid input whose UTF-8 Base64 encoding is at most 1,700 characters. It places the data after #data= in the URL. This is reversible encoding, so share only content the recipient should read. Opening such a link loads the input and removes the fragment from the address bar. For expandable inspection after checking syntax, use JSON Tree Viewer.

What are the limits for large files and schema checks?

Upload selects a JSON file and reads it as text. The validator has no explicit file-size cap, but parsing, duplicate detection and recursive statistics run on the main thread whenever input changes. Large or deeply nested documents can stall the interface or exceed browser resource limits. There is no supported maximum size or guaranteed processing time.

This is a syntax checker, not a JSON Schema validator, streaming file processor or numeric precision auditor. Native JavaScript number parsing can lose integer precision beyond the safe integer range without producing a syntax error. Keep exact identifiers as strings when your data contract requires it. Continue with the developer tools appropriate to your next task after checking syntax and reviewing warnings.

How to Use JSON Validator

  1. JSON Input

    Type JSON into JSON Input, click Paste to read the clipboard, or click Upload to choose a JSON file. Sample loads an example; checking happens automatically as the input changes.

  2. Valid JSON

    When Valid JSON appears, inspect Type, Keys and Depth. A root array also displays Items. Check any Duplicate keys warning before using the data.

  3. Invalid JSON

    When Invalid JSON appears, read Syntax Error and click its line and column details to select the affected line. Edit the input, or use Auto-fix when enabled, then review the result.

  4. Copy JSON

    After validation succeeds, use Copy JSON for the input with outer whitespace removed, Copy Stats for the summary, or Open in Formatter → to continue editing in the formatter.

Frequently Asked Questions