Fixed JSON issue, removal of last comma was in wrong place in code