zed
zed copied to clipboard
flatten/unflatten and general paths
flatten() currently has inconsistent behavior between record paths and array paths.
In this issue, we introduce the concept of a jq-like generalized path where a path defines any route through a complex value including set elements and map keys.
Flatten/unflatten will be changed to emit the entire list of path and values as records of the form:
{
path:[...],
value:...
}
By default unflatten will presume string keys are record objects and integer values are array indexes; any other type of path element will presumed to be a map key. A future version of unflatten may take an optional type when this default isn't what is intended.