📦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"] }
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
Try the Move Operation Now
Use our free online JSON Patch generator to create move patches instantly
🚀 Open JSON Patch Generator