encoding/json: decoding a null value does not replace previous value #14640
Decoding a JSON value into an already populated struct replaces the previous value stored in the struct as long as the key is present.
Example of working behaviour:
However, if the decoded value is null the previous value is not replaced.
Example of incorrect behaviour:
Is this intended behaviour for
Additionally, if this is intended behaviour the
A fixed version without possibility of incorrect results: http://play.golang.org/p/zVM9xzqIz4
The text was updated successfully, but these errors were encountered:
I believe this is working as intended and documented.
Example without a struct: https://play.golang.org/p/MmRj0E1bvV
If your struct has one of the nullable types mentioned above, such as a pointer, then unmarshaling