HTTP & JSON
jsonKey
$jsonKey[]
$jsonKey returns the key of the element being processed inside a $jsonForEach block. It takes no argument. Pair it with $jsonValue (no argument), which returns the corresponding value.
Syntax
bdfd
$jsonKey[]
Behavior
- Looping over an object: the key name (
apple,banana). - Looping over an array: the element position as text (
0,1, …). - Outside a
$jsonForEachblock it returns an empty string.
Examples
Iterate over the keys of an object
$jsonParse[{"apple":5,"banana":10}]
$jsonForEach
$sendMessage[Key: $jsonKey = $jsonValue]
$endJsonForEach
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.