HTTP & JSON
jsonIndex
$jsonIndex[]
$jsonIndex returns the current iteration index (starting at 0) inside a $jsonForEach block. It takes no argument.
Syntax
bdfd
$jsonIndex[]
Behavior
- Inside
$jsonForEachit is0for the first element,1for the second, and so on. This is the position in the loop, also for objects (use$jsonKeyfor the key). - Outside a
$jsonForEachblock it returns an empty string (not0).
Examples
Numbered list
$jsonParse[{"servers":["Alpha","Beta","Gamma"]}]
$title[Server Lookup]
$jsonForEach[servers]
$addField[Server #$jsonIndex;$jsonValue;yes]
$endJsonForEach
$color[#5865F2]
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.