tidwall / sjson

Set JSON values very quickly in Go
MIT License
2.4k stars 165 forks source link

Feature request: ability to use customized json marshaler #48

Open povsister opened 3 years ago

povsister commented 3 years ago

When a type is not recognized, SJSON will fallback to the encoding/json Marshaller.

The standard json library doesn't support type registration, so it's not very ideal to handle complex or customized struct marshaling. I'd like to have a package level variable in sjson holding a global json marshaler which will be used when a type is not recognized. Or, we can add a new option in SetOptions specifying the marshaler used for this Set call ? I prefer the former way, maybe we can add them both ?