I’d like to announce the availability of PreviewJson 2, the new, second generation release of my QuickLook preview and icon thumbnail generator for macOS. It’s available now from the Mac App Store.

This version is noteworthy in two respects. First, it’s a major update for an app I launched back in 2019. Second, it contains my first experiment with vibe coding — AI programming assistance, for those not au fait with the argot.
The new release incorporates two key changes: a completely refreshed UI and a new JSON rendering engine. The former was straightforward: it follows the pattern laid down by my other QuickLook-oriented apps, PreviewCode and PreviewMarkdown. The goal of the revamped UI is to make more clear how to personalise the look of JSON file previews on the desktop, and more quickly to achieve.
The engine replacement was trickier. The previous renderer did the job, but had an irritating flaw: JSON objects’ keys could appear out of order. The JSON standard doesn’t mandate ordering, so Apple’s Swift JSON decoder doesn’t guarantee to output Swift data structures that match the order of elements in the original JSON text.
I wanted to ensure that previews closely match the data order in the file they’re previewing. So I had to write something new. Enter AI, not to generate the finished code — where’s the fun in that? — but to give me a steer on how to write a character-by-character parser that not only generates real data from the JSON stream, but maintains its order.

I am not a computer scientist, or a trained engineer. I’m a programming autodidact. While I’ve been coding for years, I’m the first to admit that my learning has been driven almost entirely by needs of each project I’ve undertaken. I have not, for good or ill, had the general preparatory grounding in algorithm design and development, and useful data structures, that engineers who learned at university and on the job possess. They have a mental framework that generally indicates the gaps in their knowledge: the ‘known unknowns’. For me, they’re more ‘unknown unknowns’. Converting some of the latter to the former has been one of joys for me of working with real engineers over the past decade or more.
So, not having a tame software engineer handy, I ran my problem past Anthropic’s Claude, just on the free tier, to see how it would cope.
The first pass was OK, but not quite what I thought I’d asked for, though that may be down to how I framed the query rather than Claude’s interpretation of it. And while the code worked for the AI’s generated or acquired JSON sample, it creaked a tad when faced with some of the more complicated files in my PreviewJson test suite. However, with a couple of further iterations, the code began to take shape, and most importantly for me, pointed out some useful Swift elements I can use next time.
A case in point: Swift’s CustomStringConvertible protocol, which defines how to provide descriptive textual output for string and non-string properties of structures and class instances. This was new to me, and I’m glad I was exposed to it.

With baseline working code, I had something to move forward with. There was plenty of refactoring work to be done — I spotted a lot of code repetition, for instance. Reading it back and understanding the flow prompted me to make some performance improvements. I just had to rework the style. The code that eventually got used in the app was as much mine as Claude’s. But I achieved my goal rather more quickly than I might otherwise have done, without much of the early trial and error that I’d have undoubtedly otherwise gone through trying to figure out the solution from scratch. That’s a win for delivery time, which is handy for a one-guy shop like me.
Will I do this again? Quite possibly. Not for producing completely fresh apps in their entirety, for sure. As I say there’s no fun in that, and I program more for pleasure than profit (which is just as well, because I’m a long way from being able to quit the day-job). But as a tool to help me explore problems and potential solutions to them, I can certainly see myself repeating this experiment in future. Having a real problem to solve also helps assessing the worth of the tool too, which is one reason why I hadn’t leapt into the AI fray before.
