Validate JSON before you depend on its contents.
A JSON document can look reasonable and still fail before your application reads a single field. Start by checking its syntax, fix the first reported failure, and then check whether the parsed values meet your contract. Separating these steps makes debugging faster and prevents a successful parse from being mistaken for correct application data.
Know what valid JSON permits
JSON has six value types: object, array, string, number, boolean, and null. A complete document contains one value, which means a top level string or number is valid even if an API expects an object. Objects contain named properties, arrays contain ordered values, and both can nest. Boolean literals are lowercase true and false; null is also lowercase. Numbers cannot include a leading plus sign, and special JavaScript values such as NaN and Infinity are not JSON numbers.
Strings and object keys must use double quotes. Inside a string, escape embedded double quotes, backslashes, and control characters such as literal newlines. Separate properties and array items with commas, but never leave a comma after the last item. Comments, single quotes, and unquoted keys are not part of the grammar. Whitespace between tokens is allowed, so indentation does not determine whether a document parses.
Read the first parser error
Open the JSON validator and paste the original text into the editor. The live Valid or Invalid badge reports syntax status, and an invalid document shows the exact parser error message. Read that message before changing anything. An unexpected token often means the parser encountered a character where the grammar required something else. An unexpected end usually means a value, closing quote, bracket, or brace never arrived.
If the message includes a position, line, or column, inspect that location and the text immediately before it. Position conventions depend on the parser, so do not assume every tool counts bytes or starts at one. A missing comma can be reported at the next property name rather than where the comma belongs. Correct the earliest plausible cause, then validate again; later failures may simply be consequences of that first mistake.
Fix quotes and separators carefully
Consider an object copied from JavaScript with an unquoted name key, a single quoted string value, and a trailing comma. First wrap the key in double quotes, then change the string delimiters, then remove the final comma. Do not globally replace every apostrophe: an apostrophe inside a person's name is legitimate string content. If a value contains a double quote, escape that character rather than treating it as the end of the value.
Next check the boundaries between properties and array items. When a parser stops at the second key, inspect whether the previous value has its separating comma. When it stops at a closing bracket or brace, look for a trailing comma or the wrong closing character. Remove comments only outside strings. A URL containing two slashes is data, not a comment, and deleting its suffix would silently change the document you are trying to validate.
Use repair as a reviewed edit
The JSON repair page handles trailing commas, single quoted strings, unquoted object keys, missing commas between properties, and both line and block comments. Its tokenizer distinguishes strings from surrounding syntax, so apostrophes and URLs inside values are not damaged by broad text substitutions. Use repair when several of these familiar issues appear together, especially in configuration copied from a JavaScript example rather than produced by a JSON serializer.
Keep the original text available and review the repaired result before using it. Repair addresses supported syntax problems; it cannot establish what an author intended by an incomplete value or an ambiguous edit. Validate the output again and inspect important fields in the tree. Double click a value to correct it inline when needed. For repeated failures from one producer, fix its serialization process instead of making repair a permanent step in every consumer.
Check the contract with a schema
Syntax validation answers whether the text follows JSON grammar. It does not establish that an age is nonnegative, that an email property exists, or that a response contains an array instead of an object. A string containing digits remains a string even if a human reads it as a number. Move to the JSON Schema validator after syntax succeeds, and describe the types, required properties, and bounds your application actually relies on.
CurlyBrackit uses Ajv for schema validation and reports errors by path. A message such as /age: must be >= 0 points to a value that parsed successfully but violates a numeric constraint. Fix the value or revise the schema if the constraint is wrong; adding indentation will not resolve it. Check that properties are explicitly required when absence is forbidden, because defining a property's type alone does not necessarily require that property to exist.
Verify the result before sharing
After syntax and schema checks pass, inspect values that have business significance. A valid date string can refer to the wrong day, and a valid identifier can belong to the wrong account. Search keys or values to locate suspect records, and use the tree's copy path action to report exactly where a problem occurs. Distinguish these semantic checks from grammar so another developer can reproduce the same failure without guessing what valid means.
Export the checked JSON only after reviewing the changes. Processing stays in your browser, with nothing uploaded to a server, and the loaded app works offline. That helps when investigating private payloads, but sharing is a separate decision: a share link contains the compressed payload in its URL fragment. Treat that link as a copy of the data, remove sensitive fields before distributing it, and retain an original fixture when documenting the producer's bug.
Related tools
Frequently asked questions
Can valid JSON contain comments?
No. Neither line comments nor block comments belong to JSON grammar. Remove them outside strings or use the repair page to handle supported comment syntax. Slashes inside a quoted URL remain ordinary string content and should not be removed.
Why does my valid JSON fail schema validation?
A successful parse checks grammar, not your application's contract. A schema can reject missing required properties, incorrect types, or values outside allowed bounds. Read the reported path and constraint, then compare both the data and schema with the intended contract.
Does repair guarantee the intended data?
No. Repair can correct supported syntax patterns, but it cannot prove that a value matches the author's intent. Review important fields, validate the repaired document, and apply a schema when you need checks beyond the JSON grammar.