unflatten

Table of Contents

Function

unflatten — transform an array of key/value records into a record.

Synopsis

unflatten(val: [{key:string|[string],value:any}]) -> record

Description

The unflatten function converts the key/value records in array val into a single record. unflatten is the inverse of flatten, i.e., unflatten(flatten(r)) will produce a record identical to r.

Examples

Simple:

yield unflatten(this)
[{key:"a",value:1},{key:["b"],value:2}] 
Loading...

Flatten to unflatten:

over flatten(this) => (
  key[0] != "rm"
  | yield collect(this)
)
| yield unflatten(this)
{a:1,rm:2} 
Loading...
Next: upper

SuperDB