JSON Patch Applier
Apply a minimal RFC 6902-style add/remove/replace patch with RFC 6901 pointers to a JSON document.
Description
Apply add, remove, and replace JSON Patch operations to a JSON document using JSON Pointer paths.
When to use JSON Patch Applier
- Apply deterministic changes to an API fixture
- Test JSON Pointer paths against nested arrays and objects
- Replay a patch generated by the JSON diff tool
How the calculation works
Interpreting the result
`result` is compact serialized JSON and `appliedOpCount` is the number of completed operations. The tool rejects a missing path, an invalid array index, malformed JSON, or an unsupported operation instead of silently changing a different location.
Important limitations
- This focused implementation supports `add`, `remove`, and `replace`; RFC 6902 `move`, `copy`, and `test` are not implemented.
- Removing the entire document through the empty root pointer is intentionally rejected.
- Patch order is significant and operations are not automatically reordered.
References
-
RFC 6902: JavaScript Object Notation (JSON) Patch — RFC Editor
-
RFC 6901: JavaScript Object Notation (JSON) Pointer — RFC Editor