March 28, 2025

ikayaniaamirshahzad@gmail.com

Incomplete JSON Pretty Printer


Incomplete JSON Pretty Printer. Every now and then a log file or a tool I’m using will spit out a bunch of JSON that terminates unexpectedly, meaning I can’t copy it into a text editor and pretty-print it to see what’s going on.

The other day I got frustrated with this and had the then-new GPT-4.5 build me a pretty-printer that didn’t mind incomplete JSON as a web page, using an OpenAI canvas. Here’s the chat and here’s the resulting interactive.

I spotted a bug with the way it indented code today so I pasted it into Claude 3.7 Sonnet Thinking mode and had it make a bunch of improvements – full transcript here.

Animated GIF demo - as I type JSON it is pretty printed below, at the end I click the Load Pelican Example button.



Source link

Leave a Comment