Formatting is a two-step round trip: parse, then re-serialize.
JSON.parse()reads your text into a real data structure — this is also where syntax errors are caught, with the exact position reported.JSON.stringify(value, null, 2)writes it back out with 2-space indentation for readable output.- Minify uses
JSON.stringify(value)with no indentation, collapsing everything to a single line for compact storage or transmission.
Formatting never changes your data's meaning — only its whitespace.