zed icon indicating copy to clipboard operation
zed copied to clipboard

flatten/unflatten and general paths

Open mccanne opened this issue 2 years ago • 0 comments

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.

mccanne avatar Nov 29 '23 21:11 mccanne