I assumed that after Unmarshal returns, the struct would exactly match the provided JSON. I found this quite surprising and I think the documentation should mention that "Fields that are not present in the JSON document will retain their original values."
The existing functionality does give one an elegant way to set default values by having Unmarshal only update those fields which are present in the JSON document. I do not dispute that it is useful. Still, I would like to see the documentation mention this behaviour explicitly.
The text was updated successfully, but these errors were encountered: