DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Forgiving pretty-print

What is the best way to pretty print a possibly malformed JSON string? (which is a very long string, impossible to validate and fix by eyes...)

Pretty printing should work, albeit partially, if JSON is malformed.

Just like web browser can render malformed HTML.

Top comments (2)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

My challenge is JSON is malformed, but pretty-printing should still works. (probably to a limited extent)

Collapse
 
dawx profile image
Dawx

I guess you could use JSON Formatter extension for chrome it will format it on screen but I don't know if how it would look like if you print it, worth a try though