Berserk Docs
Scalar FunctionsDynamic / JSON Functions

bag_zip

Builds a property bag by pairing an array of keys with an array of values.

A key without a value gets null, extra values are dropped, non-string keys are skipped, and a repeated key keeps its last value. If the keys are not an array, the result is null; if the values are not an array, every key gets null.

Syntax

bag_zip(keys, values)

Parameters

Prop

Type

Returns: dynamic

Examples

Example 1

print bag_zip(dynamic(['ship', 'crew', 'oars']), dynamic(['Long Serpent', 60]))
print_0 (dynamic)
{"crew":60,"oars":null,"ship":"Long Serpent"}

On this page