avoid code duplication between StatsJsonTemplate and StatsJsTemplate