Checking JSON syntax without assuming the data matches a schema
A document can be valid JSON and still be wrong for the program that receives it. This worksheet formats a number and a numeric string for the same property and shows that both pass.
Two layers of correctness
Syntax correctness asks whether the text follows the JSON grammar: matching braces, quoted names, legal numbers, no trailing commas. A spell checker is a fair analogy, since it can confirm that every word is a real word and cannot tell whether the sentence says what you meant. Schema correctness asks whether the content has the shape a particular application expects: which properties must exist, what type each holds, which values are allowed. A formatter answers only the first question. A document can pass the first and fail the second in many ways, and the tool has no information about the second because it does not know what you are sending the document to. The same document can be correct for one endpoint and wrong for another, so the answer to the second question always depends on who receives it.
A number and a string for count
The first control is {"count":3}, where count holds the number 3. The second is {"count":"3"}, where count holds a string that contains the character 3. Both pass the syntax check, and the compact output of each matches its input. The only visible difference is the pair of quotation marks. Yet the two are different types. Arithmetic on the first works directly, while arithmetic on the second needs a conversion, and some languages concatenate instead of adding when they meet a string. In JavaScript, for instance, adding the string "3" and the number 4 gives the string "34", while adding the numbers gives 7. Comparisons, sorting and equality checks all behave differently for the two types.
How a mismatch plays out in practice
Imagine an API documented to receive a numeric count. A client that sends the string form passes every syntax check along the way and is then rejected by the server with a type error, or worse, accepted and misinterpreted. A strongly typed language may refuse to load the field. A loosely typed one may coerce it and hide the problem until a comparison fails, for example when the string "10" sorts before "9" in text order. The JSON itself is valid, and the fault sits in the mismatch between what the sender wrote and what the receiver expected.
Other valid values with the wrong type
The same logic applies broadly. A boolean true is different from the string "true". A date in text such as "2026-11-06" is a string whose date meaning exists only in the receiving contract. A number written as 3.0 and one written as 3 may be interpreted as a float and an integer by a strict consumer. An empty array and a missing property are different. Each is valid JSON and may be invalid for the application. Reading the interface documentation before you build a document is the reliable way to avoid these. Payment and booking interfaces are especially strict, because an amount sent as text can be refused or, in a lenient system, silently rounded, and the sender may not learn which until a reconciliation report.
What schema validation adds
JSON Schema is a vocabulary for describing the allowed shape of a document, with keywords for type, required properties, numeric ranges, string patterns and array contents. A validator reads a schema and a document and reports where they disagree, such as a count that is a string where the schema says integer. That is a separate tool from a formatter, and it needs the schema from whoever defines the interface. This page loads no schema and enforces no required properties, so a pass here is a statement about grammar alone. Tools that do validate against a schema usually report the path to the offending field, such as the count property of the first item, which a syntax checker cannot provide.
Removing quotes from digit-shaped text
When a consumer rejects a string, the tempting fix is to remove the quotation marks around digits everywhere. That can break fields that must stay text, such as postal codes, phone numbers and identifiers with leading zeros, where 00123 as a bare number is not valid JSON at all and would change meaning if it were. Decide field by field using the consumer's definition. Change the data only where the documentation says the field is numeric, and test the result with the consumer or its published validator.
Checks you can run before sending
A short routine catches most type errors. Compare each field in your document with the interface description and note its expected type. Look at a sample of real values for quotes that should not be there or are missing. Pay particular attention to values that arrive from forms, spreadsheets or query strings, since those sources are text by default and every number in them starts life as a string. Convert deliberately, field by field, before the document is built. Run the document through the consumer's own validation if one exists, such as a schema file or a test endpoint. Keep a known-good example document and diff your output against it, ignoring values. If the interface publishes example requests, copy the structure from those and change only the values you need. These steps cost little compared with debugging a rejected production request.
Scope of the formatter
The tool parses, validates syntax and formats. It does not load a schema, enforce required properties or verify a business rule. A successful result for either control means only that the text is legal JSON. The output also keeps the type distinction visible, since the quotation marks around the 3 survive formatting exactly as typed, so you can use the formatted text to confirm which form your producer is actually emitting. The choice between 3 and "3" belongs to the receiving system's documented contract.
Converting a string field to a number deliberately
When a field really should be numeric, make the change at the source that produces the document. A database export that wraps every value in quotes can usually be configured to emit numbers for numeric columns. A script that builds JSON by joining text should hold the value in a number type and let a JSON library write it. After the change, check the edge cases that the old string form allowed: an empty value, a value with a unit such as "3 kg", a thousands separator such as "1,200" and a leading zero. Each of those has no legal numeric spelling in JSON, so the source data may need cleaning first.
Reproduce the checks
A numeric value
Open the Json Validator Formatter and enter:
- JSON input
{"count":3}- Indent
0
Expected output:
Valid
trueFormatted
{"count":3}The value is represented by a number token.
A string value
Open the Json Validator Formatter and enter:
- JSON input
{"count":"3"}- Indent
0
Expected output:
Valid
trueFormatted
{"count":"3"}The digits remain string content.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08