The previous implementation could produce illegal JSON when used
with serde_json.

This is a breaking change because we have to add a Clone bound on
the Deserialize impls.