Within context like this:

#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct Id<T: Register> {
    id: &'static str,
    _phantom: PhantomData<T>,
}

serde_derive intelligently recognizes that there is no need to serialize _phantom and the #[serde(transparent)] flag simply works.