Returns data to client in specified format