For JSON data I suggest:
Mustache.render(template, settings).replace(/,(?=\s*[}\]])/mig,'');
The regexp will remove any , left hanging after the last properties.
This will also remove , from string values contining ", }" or ", ]" so make sure you know what data will be put into your JSON