Added group by with JSON parsing