Categorygithub.com/ciscom31/json-patch
modulepackage
3.0.0+incompatible
Repository: https://github.com/ciscom31/json-patch.git
Documentation: pkg.go.dev

# README

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

GoDoc

Build Status

API Usage

  • Given a []byte, obtain a Patch object

    obj, 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)

# Packages

No description provided by the author

# Functions

CreateMergePatch will return a merge patch document capable of converting the original document(s) to the modified document(s).
DecodePatch decodes the passed JSON document as an RFC 6902 patch.
Equal indicates if 2 JSON documents have the same structural equality.
MergeMergePatches merges two merge patches together, such that applying this resulting merged merge patch to a document yields the same as merging each merge patch to the document in succession.
MergePatch merges the patchData into the docData.

# Type aliases

Patch is an ordered collection of operations.