📦JSON Patch Move Operation
Relocate values within JSON documents
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
Examples
Move Property
Rename/relocate a property
Patch:
Before:
After:
Move to Nested Path
Move a value deeper into the structure
Patch:
Before:
After:
Reorder Array
Move an array element to a new position
Patch:
Before:
After:
Real World: Promote a Nested Value
Lift a field out of a nested object during a schema migration
Patch:
Before:
After:
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