Automatic merge from submit-queue (batch tested with PRs 61354, 61366, 61386, 61394, 60755). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. vendor: Update github.com/evanphx/json-patch Updates github.com/evanphx/json-patch dependency to fix handling tests against empty objects/arrays. Includes fix from evanphx/json-patch#50 Kubernetes-commit: 18a7ea703bdf09f1ff0b83e15b3febf49a447a24 |
||
|---|---|---|
| .. | ||
| .travis.yml | ||
| LICENSE | ||
| README.md | ||
| merge.go | ||
| patch.go | ||
README.md
JSON-Patch
Provides the ability to modify and test a JSON according to a RFC6902 JSON patch and RFC7396 JSON Merge Patch.
Version: 1.0
API Usage
-
Given a
[]byte, obtain a Patch objectobj, err := jsonpatch.DecodePatch(patch) -
Apply the patch and get a new document back
out, err := obj.Apply(doc) -
Create a JSON Merge Patch document based on two json documents (a to b):
mergeDoc, err := jsonpatch.CreateMergePatch(a, b) -
Bonus API: compare documents for structural equality
jsonpatch.Equal(doca, docb)