MicroToolHub

Format JSON and find the first useful error

Repair one small catalog record, distinguish syntax from meaning and preserve IDs with leading zeros.

Try a record you can inspect by eye

Start with {"sku":"0017","stock":4,"active":true}. Formatting should show one object with three properties. Notice that the SKU uses quotation marks, the stock count is a number and the availability flag is a Boolean. If you minify it, the whitespace can disappear while these types and values remain the same.

Open JSON Formatter →

Work backward from the reported position

A copied object may contain a comma just before its closing brace, single quotes around a name or a missing closing quote. A parser can first notice the problem several characters after its cause. Inspect the reported area and the previous property. Fix one issue and validate again so the next message has a clear meaning.

Check the recipient’s data contract

The record {"stock":"four"} is valid JSON. An inventory importer may still reject it because it expects an integer. A formatter can confirm that a document parses. You still need to check required properties, data types, allowed values and units against the receiving application’s instructions.

Preserve identifiers and originals

Keep identifiers such as 0017 inside strings when the receiving schema expects text. JavaScript numbers have precision limits, so long numeric IDs can change during a parse-and-export round trip. Keep the source and compare important fields before using a reformatted file for a migration. Avoid duplicate property names because parsers may retain only one of the values.

Use JSON Formatter

Further reading

MDN · JSON.parse syntax and number precision