rpgmaker / NetJSON

Faster than Any Binary? Benchmark: http://theburningmonk.com/2014/08/json-serializers-benchmarks-updated-2/
MIT License
225 stars 29 forks source link

SerializeObject will return string "null" in net48 but null in net core when the param "value" is null. #249

Open Mutuduxf opened 3 months ago

Mutuduxf commented 3 months ago

Version 1.4.4, when I wrote unit tests for serializers in diference Target Frameworks (net48 / net6.0 to net 9.0) I found this case. The codes like this:

NetJSON.NetJSON.SerializeObject(value, null); // value is null

In net48 it will return a string "null", but in net core it will return a null object.

rpgmaker commented 3 months ago

Thanks for calling it out. It must be an extra call happening that caused it to wrap it in a quote. I will look into it. Thanks

Mutuduxf commented 3 months ago

Thanks for calling it out. It must be an extra call happening that caused it to wrap it in a quote. I will look into it. Thanks

Thank you for your reply, I think returning string "null" will be better because this is the same way other json serializers handle it.