variablesJSON
Collects the variables whose names start with a prefix into one record.
Keyboard Maestro: JSONFromVariables
Details #
variablesJSON(prefix) takes exactly one argument and returns a record. Every variable in the run whose name starts with prefix becomes a key, named by the rest of the name after the prefix.
A variable named exactly the prefix is left out, since nothing remains for its key.
Parameters #
Takes 1 argument.
{{ variablesJSON(text) }}
Examples #
variablesJSON("user_")→
{
"age" : 36,
"name" : "Ada"
}| Sample variable | Value |
|---|---|
other | 1 |
user_age | 36 |
user_name | Ada |
jsonText(variablesJSON("user_"))→
{"age":36,"name":"Ada"}| Sample variable | Value |
|---|---|
user_age | 36 |
user_name | Ada |
Gotchas #
The prefix is case-sensitive and plain text, not a pattern.
Only variables in the current run count; nothing is read from disk.