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 ?
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 inSetOptions
specifying the marshaler used for thisSet
call ? I prefer the former way, maybe we can add them both ?