Skip to content
HTTP & JSON jsonClear

$jsonClear[]

$jsonClear empties the JSON document of the current command, as if no $jsonParse or $jsonSet had run; everything previously stored is discarded. It does not put {} back. It takes no argument and returns an empty string.

Syntax

bdfd
$jsonClear[]

Behavior

  • After $jsonClear, $jsonStringify and $jsonPretty return an empty string, and $jsonExists[...] and $jsonArrayIndex[...] also return an empty string (not false / -1) until a new $jsonParse or $jsonSet. A later $jsonSet[b;1] starts a new document: {"b":1}.
  • $jsonClear is not the same as $json with no argument, which only reads the document. $jsonUnset with no argument has the same effect as $jsonClear.

Examples

Reset JSON Context

$jsonParse[{"temp":"data"}]
$jsonClear
$title[Clear JSON Context]
$description[JSON document after clearing: `$jsonStringify`]
$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.