serialize the $key