Pretty-print JSON by parsing it for real, never eval, never a regex rewrite. JSON.parse accepts only JSON, so nothing in the source can execute, and a malformed document is reported rather than half-formatted.
eval
JSON.parse
Optional
Pretty-print JSON by parsing it for real, never
eval, never a regex rewrite.JSON.parseaccepts only JSON, so nothing in the source can execute, and a malformed document is reported rather than half-formatted.