moved all the last comma trimming to the Jsonitem struct