move
Description
The move command relocates a keypath to a new position within a document.
This is useful when keypaths are deeply nested or inconsistently structured,
making queries cumbersome to write and read.
When a keypath is moved, its value (and any child keys if it’s an object) is transferred to the target keypath, and the original keypath is removed.
If the source keypath is an object, the entire key and all child elements are moved to the new location.
Syntax
(m|move) <source-keypath> to <target-keypath>
Example
Use case: Simplify access to nested data
Suppose your document has deeply nested metadata under multiple object levels,
and you want to bring one of those fields—like labels—to the top level for
easier querying and readability.
Example data
{
"data": {
"my_data": {
"labels": {
"label1": "value1"
}
}
}
}
Example query
move data.my_data.labels to labels
Example output
{
"data": { "my_data": {} },
"labels": { "label1": "value1" }
}
After executing move, the labels object is relocated to the top level, and
the original nested structure (data.my_data.labels) is removed. Queries can
now access labels directly instead of traversing multiple layers.