Remove trailing commas

Remove trailing commas and spaces from items.
This is required for compatibility.