json.set

From RPTools Wiki
Revision as of 12:30, 24 December 2008 by Craig (talk | contribs) (New page: ==Function json.set== '''Introduced in MapTool 1.3b49''' Sets the value in at the specified index in a Macros:json array or for the specified key in a Macros:json object. You...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function json.set

Introduced in MapTool 1.3b49

Sets the value in at the specified index in a json array or for the specified key in a json object. You can use an empty string ("") to represent a new json object.

Usage

[h: jarr = json.set(jarr, index, value)]
[h: jarr = json.get(jobj, key, value)]
[h: jarr = json.get(jobj, key, value, ..., ...)]


Examples

  [json.set("{}", "a", 5)]
  [json.set("", "a", 5, "b", 8)]
  [json.set(json.fromList("1,3"), 0, 8)]

Returns

 {"a":5}
 {"a":5, "b":8}
 [8, 3]