Capy-Bearer Documentation

Get child keys

lib call

Capy

function keys(value : any) any

Description

keys(value) returns a new list of child keys. Maps use insertion order, including empty-string keys. Lists use numeric order. A scalar returns an empty list.

Parameters

value : source value

Return Values

A list of child keys.

Example

Capy

var user := {"name": "Ada", "role": "admin"}
print(join(sort(keys(user)), ","), "\n")

Output

name,role