Serialize keys using JSON.serialize

`url.format()` is a poor choice for serialization when non-standard properties are tacked on, as they get dropped (and when `uri.query` properties aren't also included in `uri.path`).