A JSON Patch library that makes it easy to construct patch operations by hand.
go get -u github.com/jamiecuthill/patchway@mainops := patchway.Operations{
patchway.Replace(first_name, "name", "first"),
patchway.Replace(last_name, "name", "last"),
}Use in conjunction with a JSON Patch SDK as follows
patch, err := jsonpatch.DecodePatch(ops.Bytes())
if err != nil {
panic(err)
}
modified, err := patch.Apply(original)
if err != nil {
panic(err)
}