json.toVars: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 04:19, 22 September 2019

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