remove trailing commas in arrays