json-iterator / go

A high-performance 100% compatible drop-in replacement of "encoding/json"
http://jsoniter.com/migrate-from-go-std.html
MIT License
13.43k stars 1.03k forks source link

Non global RegisterXXXEncoder and RegisterXXXDecoder #530

Open Segflow opened 3 years ago

Segflow commented 3 years ago

After reading the code, I believe that once we register a type, struct field encoder/decoder, they get registered globally.

Any reason for this?

How can I have different encoder for the same type? let's say endpoint A needs to encode a type X in a way different then how endpoint B.