Proposal Details

json/v2 already has the format option format:hex for []byte types. However hex bytes are often encoded with a 0x prefix. This could be made possible by an additional format type (e.g. called 0xhex).

Encoding bytes with 0x-prefix is already possible via a custom (un)marshaler. However, doing this at the library level has the benefit that the encoded string does not need extra checks for escape characters.

Comment From: seankhliao

I've had the displeasure of working with 0x-prefixed hex strings, I don't think we should encourage their use anywhere.