I’m surprised there is no commonly-available solution for viewing Git logs as JSON documents.

It is very useful to convert logs to JSON, because JSON is immediately consume-able by almost all general-purpose data visualization tools — everything from jQuery UI to MatPlotLib, “speaks” JSON. So with Git logs converted to JSON, it becomes possible to perform all sorts of ad hoc historical analysis of source code repositories.

tl;dr: just take me to the code!

Historical analysis of source code repositories is very important, because code churn metrics are the best bug predictors known.

However, there is to my knowledge no simple, stand-alone tool to do the conversion! In practice, converting Git logs to JSON requires either relying on some large, third-party library that has already implemented git-log-to-JSON functionality, or writing regular expressions that turn out to be a bit of a pain in the ass.

Since there’s no commonly-available simple tool, I wonder how many people wind up putting off their Git log analysis because of the time overhead involved in JSON output conversion. If this were the case, it would really be too bad because code churn metrics are the best predictors of bugs; as discussed in this video from GTAC, which details a recent study of the Eclipse editor code base:





Making it easy to get the Git log as a JSON document!

Here’s a gist I wrote, which hopefully takes the mystery out of converting to to JSON. It has since been referenced from a popular question on StackOverflow. I’m glad someone else found this useful!