Start with valid JSON
Object keys and strings require double quotes. Boolean values are true/false and an empty value is null. JavaScript object literals are not necessarily JSON: comments, single quotes and trailing commas can fail parsing.
Inspect quotes, commas and brackets near the error. Reduce a large input to one object or array, locate the problem, then restore the full data.
Formatting and minification preserve meaning
Formatting adds indentation and newlines for reading. Minification removes unnecessary whitespace for transfer. Neither is data cleaning: they do not remove sensitive fields or prove an API response correct.
The object below has the same data meaning in either layout. Two-space indentation helps reveal nesting, but business fields still need inspection before you copy the result.
{"b":2,"a":1}
{
"b": 2,
"a": 1
}Key sorting is not array sorting
Recursive sorting rearranges object keys to make configuration comparison easier. Array elements retain their order; this option does not sort products, records or dates.
For example, {"b":2,"a":1} can become {"a":1,"b":2}, while [2,1] stays [2,1]. Test compatibility separately if an external system relies on key order.
Check types after syntax
"18" is a string and 18 is a number. Syntax validation does not require an age field or enforce an integer type; use JSON Schema for those constraints.
JavaScript numbers can lose precision above the safe integer range. Keep long order numbers or database IDs as strings when the API requires it. Retain the source when exact bytes or ordering matter.