Browse the docs

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 variableValue
other1
user_age36
user_nameAda
jsonText(variablesJSON("user_"))
→ {"age":36,"name":"Ada"}
Sample variableValue
user_age36
user_nameAda

Gotchas #

  • The prefix is case-sensitive and plain text, not a pattern.

  • Only variables in the current run count; nothing is read from disk.