For example, when encoding the following struct instance to JSON:
type Example struct {
Name patch.Field[string] `json:"name"`
Age patch.Field[int] `json:"age"`
}
patch := &Example{
Name: patch.Field[string]{Valid: false},
Age: patch.Field[int]{Valid: true, Value: 10},
}
Encode patch to JSON:
Got:
Expect: