A URL-encoded value is by definition a collection of key-value pairs. Serializing an atomic value directly results in the serializer returning an error: "top-level serializer supports only maps and structs". I don't think what you want is possible.
What do you need this for? I'm pretty sure there is a better solution for what you are actually trying to achieve.
That's likely not the case – what if you have a complex type, e.g. a HashMap , a struct, or even just some sort of sequence? What do you want to do in that case?
In my case I'm using htmx to pass the form as axum::extract::Json<MyInput> to a handler, so serde is already there and all fields of MyInput implement Serialize. So I'm ok for the encoder to accept any serializable even if output won't make sense for complex types.