Move pretty printing code from web API to pretty print function.