json.toVars

From RPTools Wiki
Revision as of 04:19, 22 September 2019 by Merudo (talk | contribs) (Created page with "{{MacroFunction |name=json.toVars |version=1.5.5 |description= Creates variables from a from a JSON Object. The names of the variables are the keys of the object, while th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

json.toVars() Function

Introduced in version 1.5.5
Creates variables from a from a JSON Object. The names of the variables are the keys of the object, while the variables are assigned the values of the object.

Usage

json.toVars(jobj)
json.toList(jobj, prefix)
json.toList(jobj, prefix, suffix)

Parameters

  • jobj - The json Object.
  • prefix - The prefix to add to the name of each variable. Defaults to an empty string "".
  • suffix - The suffix to add to the name of each variable. Defaults to "".

Examples

[h: json.toVars(json.set("{}", "a", 1, "b", 2, "c", 3))]
[r: a] [r: b] [r: c]

Returns

1 2 3