Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/json: Change of behaviour when decoding json null values into RawMessage #11937
The behavior change with json.RawMessage was not intended.
But the documentation says: "The JSON null value unmarshals into an interface, map, pointer, or slice by setting that Go value to nil." A json.RawMessage is a byte, so setting it to nil (instead of [110 117 108 108]) seems to be in line with the documentation.
I'm not sure the original authors of this package consider a json.RawMessage should always have the same behavior than a byte though.
Some of my code has been hit by this bug.
I'm relying on the fact that