Zero Signup ToolsFree browser tools

Developer Tools

JSON Patch Builder

Generate and apply RFC 6902 JSON Patches in your browser. Compute add, remove, replace, move, and copy ops between two JSON docs, then apply them step by step.

JSON Patch builder and applier

RFC 6902 operations: add, remove, replace, move, copy, test.

Operations

  • add inserts a value at a path. On an array, the index may be 0 to length, or - for append.
  • remove deletes the value at a path. The path must already exist.
  • replace overwrites the value at a path. Equivalent to remove + add and requires the target path to exist.
  • move takes the value at from and places it at path. The destination must not be a child of the source.
  • copy duplicates the value at from into path. The source path is left untouched.
  • test asserts that the value at a path equals the expected value. A failed test aborts the patch.

JSON Pointer reminders (RFC 6901)

  • The empty string "" points to the whole document. Operations targeting the root replace or read the whole value.
  • Each token is preceded by a slash, and a literal slash inside a token is written ~1; a literal tilde is written ~0.
  • On arrays, the token must be a non-negative integer without leading zeros, or - to refer to the position after the last element (valid in add only).
  • The pointer /a~1b resolves the key a/b; the pointer /items/0/name targets the name field of the first item.

How to use

  1. Pick a mode. Generate computes a patch from two JSON documents. Apply runs an existing patch against a source.
  2. In Generate, paste the source JSON on the left and the target JSON on the right, or click Load sample for a runnable example. The minimal RFC 6902 patch appears below with a copy button.
  3. Toggle Detect move to compress remove plus add pairs of the same value into a single move op, and Detect copy to express duplicated values as copy ops.
  4. Use the operation summary cards on the left to inspect every op, including the path, optional from, and a short preview of the value.
  5. In Apply, paste the source JSON and the patch (a JSON array of op objects). Each step shows pass or fail with the exact reason; the resulting document is rendered on the right and can be copied with one click.
  6. Per RFC 6902, a failed op aborts the patch atomically. The result panel shows the document state immediately before the failed op so you can fix the path or value and try again.

About this tool

JSON Patch Builder is a focused tool for working with RFC 6902 JSON Patches, the standard format used by HTTP PATCH endpoints, Kubernetes strategic merge tooling, fast-jsonpatch in Node, json-patch in Python, and many database change-tracking libraries. Two modes are exposed and share the same RFC 6901 pointer engine. The Generate mode takes a source JSON document and a target JSON document and produces the minimal patch (an ordered array of operation objects) that turns source into target. The differ walks objects key by key and arrays index by index, emitting add for new keys, remove for deleted keys, replace for scalar changes, and recursing into nested structures so changes stay close to their actual position. Two optional optimizations compact the result. Detect move rewrites a remove plus a later add of the same value into a single move op, which is the canonical RFC 6902 expression of a renamed key or a relocated array element. Detect copy turns an add of a value that already exists in the source into a copy from its existing location. After generating, the tool verifies the patch by applying it back to the source and confirming the result equals the target, so a bug in the differ never silently ships a wrong patch. The Apply mode takes a source JSON document and a JSON Patch and runs every operation in order against a cloned copy of the source. Each step is reported individually with a pass or fail badge, the canonical op summary, and a precise error message when the path does not resolve, when an array index is out of range, when remove is asked to delete a key that does not exist, when replace is asked to overwrite an unresolved path, when move is asked to move a value into one of its own children (which RFC 6902 forbids), or when a test op finds a value that does not equal the expected one (which aborts the patch atomically, per spec). The final JSON document is rendered with syntax-friendly indentation and can be copied with a single button. The full RFC 6901 JSON Pointer grammar is supported: the empty pointer for the root, escape sequences ~0 and ~1 (decoded in the spec-mandated order so ~01 round-trips as ~1), non-negative array indices without leading zeros, and the - token to refer to the position after the last array element (valid in add only). Everything runs locally in your browser; the two JSON inputs and the patch are processed in memory and never uploaded, which makes the tool safe for API contracts, internal documents, and production payload samples.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools