go-json icon indicating copy to clipboard operation
go-json copied to clipboard

Support Decoder options for Unmarshal

Open FeldrinH opened this issue 3 years ago • 2 comments

It would be nice if this library could support Decoder.UseNumber and Decoder.DisallowUnknownFields on the Unmarshal method as well. Currently, as far as I can tell, using these options requires using Decoder, which has two disadvantages:

  • If you have data that is already in a byte array then Decoder is slower according to the benchmarks
  • As far as I know Decoder has no reliable method to ensure that there is no extra data after the read json object (so for example {"value": 323};,fdaslfdaksf is considered valid by the decoder, if you only decode one object).

FeldrinH avatar Aug 24 '22 12:08 FeldrinH

any plan support DisallowUnknownFields?

kaptinlin avatar Sep 18 '23 14:09 kaptinlin

Is there any plan to support Decoder.UseNumber on the Unmarshal method.

zhujunping-zjp avatar Nov 03 '23 06:11 zhujunping-zjp