If a JSON export rejects a product code such as 00427, removing the zeros may fix the syntax while changing the code. First check the field definition and the authoritative catalog value. A code whose leading zeros matter needs a representation that retains those characters.
Confirm the required code before editing
For this fictional catalog, sku must be a string containing exactly five ASCII digits. The catalog entry is 00427, and quantity is a numeric count. This rule belongs to the example. Use the actual receiving contract for your own data.
Save the source value before testing. If a spreadsheet or export has already converted it to the number 427, retrieve the original code from the catalog. A formatter cannot infer how many zeros were lost.
Compare three small inputs in the formatter
Open the JSON Formatter and Validator. Choose 2 spaces under Indent, leave Minify and Sort keys alphabetically unchecked, and test each input separately with Format JSON.
This first input is invalid JSON.
{"sku":00427,"quantity":4}
The tool reports a parsing error. JSON number grammar does not permit this leading-zero form. Changing indentation cannot make the numeric token valid. JSON number grammar
Now remove the zeros and test this version.
{"sku":427,"quantity":4}
The formatter accepts it, but the code has become the number 427. That fails the fictional catalog contract. The success message confirms that the input parses.
Return to the authoritative code and represent it as the required string.
{"sku":"00427","quantity":4}
The formatted output retains "00427", including both initial zeros and the quotation marks. The quantity remains the number 4. Check those two fields before copying the result.
Check the string type and width separately
Both "427" and "00427" are valid JSON strings. Your receiving validation must also enforce the code rule. In JSON Schema, the following schema applies to the sku value itself.
{
"type": "string",
"minLength": 5,
"maxLength": 5,
"pattern": "[0-9]{5}"
}
The length constraints require five characters, and the pattern requires five consecutive ASCII digits. Together they reject a short code, a numeric value, or a five-character string containing a letter. JSON Schema documents these string constraints. JSON Schema string validation
Apply that check in your receiving schema validator or application. The on-site formatter provides JSON syntax checking and formatting. Its controls do not apply this schema to the submitted data.
Correct the producer and retest the export
Once the agreed field type is confirmed, update the producer to serialize the original SKU as a string. Export the same record again, format a copy, and compare its exact code and numeric quantity with the source. Test the receiving import too, including a code that starts with zero.
Keep number fields such as quantities numeric when their contract requires that type. For a broader review of field names, values and types before sharing an example, follow the API JSON formatting checklist.