mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-24 00:31:24 +00:00
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)