Put json formatting code in to separate gem.