Web presence of Neil O'Toole.


One of the benefits of using jq is that it colorizes & prettifies JSON output, making it much easier to parse visually. I wanted to do the same for sq, which is written in Go. Looking around the existing libraries landscape, I found several colorizing encoders, but each had shortcomings.

So, I created neilotoole/jsoncolor, which ticks all the boxes. It’s fast (faster than stdlib in many cases), configurable, and is a drop-in replacement for the stdlib json package. I’ve already been using it in CLIs on client projects, and it works well.

Colorization is configurable. This is the color scheme I chose for sq, mimicking jq’s color palette.

jsoncolor output