add function: serializeObject