📦JSON Patch Move Operation

Relocate values within JSON documents
RFC 6902
move operation

What is the Move Operation?

The move operation removes the value at the "from" path and adds it at the "path" location. It's equivalent to a remove followed by an add. Both paths must be valid - the "from" value must exist.

Syntax

{ "op": "move", "from": "/source/path", "path": "/destination/path" }

Examples

Move Property

Rename/relocate a property

Patch:
{ "op": "move", "from": "/old_name", "path": "/new_name" }
Before:
{ "old_name": "value", "other": 123 }
After:
{ "other": 123, "new_name": "value" }

Move to Nested Path

Move a value deeper into the structure

Patch:
{ "op": "move", "from": "/temp", "path": "/config/setting" }
Before:
{ "temp": "value", "config": {} }
After:
{ "config": { "setting": "value" } }

Reorder Array

Move an array element to a new position

Patch:
{ "op": "move", "from": "/items/2", "path": "/items/0" }
Before:
{ "items": ["a", "b", "c"] }
After:
{ "items": ["c", "a", "b"] }

Real World: Promote a Nested Value

Lift a field out of a nested object during a schema migration

Patch:
{ "op": "move", "from": "/meta/author", "path": "/author" }
Before:
{ "title": "Post", "meta": { "author": "ana" } }
After:
{ "title": "Post", "meta": {}, "author": "ana" }

Common Use Cases

  • Renaming fields during schema migrations
  • Reorganizing data structures
  • Reordering array elements
  • Moving data between nested objects

Best Practices

  • Source path must exist
  • Cannot move a value to its own descendant
  • Useful for refactoring JSON structures

Move Operation FAQ

What is the difference between move and copy?

move removes the value from the source location; copy leaves the source untouched. Rename a key with move, duplicate a value with copy.

Can I move a value into one of its own children?

No. Moving /a to /a/b is explicitly forbidden by RFC 6902 and fails - the source would disappear before the destination could be written.

Is move atomic?

Yes. The removal from from and the addition at path happen as one operation - the patch never leaves the value in a half-moved state.

Try the Move Operation Now

Use our free online JSON Patch generator to create move patches instantly

🚀 Open JSON Patch Generator