Package jsonpatch offers functionality to apply and create JSON Patch (RFC 6902) operations.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
github.com/evanphx/json-patch/v5
Applies a JSON Patch operation to a JSON document.
package main
import (
"fmt"
"github.com/evanphx/json-patch/v5"
)
func main() {
patch, _ := jsonpatch.DecodePatch([]byte(`[{"op":"add","path":"/foo","value":"bar"}]`))
original := []byte(`{}`)
result, _ := patch.Apply(original)
fmt.Println(string(result))
}
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.