serialization function for single query set