An empty update should be a fairly quiet object. Mine grew two fields after I switched JSON packages.
With the same Go struct and the same zero value, encoding/json produced {} . encoding/json/v2 produced {"count":0,"enabled":false} . Both calls succeeded.
For a PATCH-style endpoint where an absent member means “leave this alone,” that is a change in the request's meaning. The serializer hasn't become confused. The old tags are asking a different question under v2.
Outputs from the executed Go example. The PATCH interpretation is the explicitly defined example contract, not a rule imposed by JSON itself. Image by the author.
Decide what an absent field means
Go's new announcement makes encoding/json/v2 generally available in Go 1.27. [1] I used Go 1.27.3 for this example and ran both packages in the same program.
Here is my small update contract: omitted fields leave the stored value unchanged; present fields replace it.…