JSON Patch
JSON Patch is an RFC 6902 format that describes changes to a JSON document as an ordered array of operations, each with op, path, and optional value or from fields. Clients send compact patches instead of full resource bodies, which reduces bandwidth and supports optimistic concurrency on REST and sync APIs.
Technical Architecture & Deep-Dive
Operations include add, remove, replace, move, copy, and test. Each path is a JSON Pointer. A replace on /status with value shipped updates one field while leaving the rest of the document untouched.
Patch APIs shine when documents are large but edits are small. Edge workers can validate patches against a schema, reject paths outside an allowlist, and forward sanitized patches to upstream services that may not implement PATCH natively.
Key Architectural Benefits
Minimal JSON Patch
[
{ "op": "replace", "path": "/plan", "value": "pro" },
{ "op": "remove", "path": "/trialEndsAt" }
]Implement JSON Patch at the Edge
Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.
Frequently Asked Questions
Q:Is JSON Patch the same as JSON Merge Patch?
No. JSON Patch is operation-based. Merge Patch sends a partial object merged into the target document.
Related Architecture Concepts
JSON Merge Patch (RFC 7396) updates a JSON document by merging a partial object into the existing resource. Present keys overwrite or recurse into nested objects, and null values remove keys. It is simpler than JSON Patch for many REST PATCH endpoints that only need shallow or nested field updates.
JSON Pointer is an RFC 6901 syntax for identifying a single value inside a JSON document using a slash-separated path string such as /user/addresses/0/city. Pointers are the addressing layer for JSON Patch, JSON Merge Patch tools, and field mask engines that need precise, portable paths into nested payloads.
API data transformation is converting data from the format an upstream API returns into the format a client needs. It includes renaming fields, converting types and units, filtering records, computing derived values, and restructuring nested objects.