Feature/json formatting

Added a basic formatter. This was quick and dirty since Erik is writing one for the API that hopefully can be reused.
In the API I am assuming that missing value of `truncated_{before,after}` is equivalent to false. Is a null value meaningful?