avoid duplication between StatsJsonTemplate and StatsJsTemplate
Merge pull request #1067 from nremond/json_template

avoid code duplication between StatsJsonTemplate and StatsJsTemplate