json.get: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function json.get== '''Introduced in MapTool 1.3b49''' Returns the value in a Macros:json array at the specified index, or returns the value from Macros:json object for the...)
 
No edit summary
Line 9: Line 9:
===Usage===
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: jarr = json.get(index)]
[h: jarr = json.get(jarr, index)]
[h: jarr = json.get(key)]
[h: jarr = json.get(jobj, key)]
</source>
</source>



Revision as of 12:09, 24 December 2008

Function json.get

Introduced in MapTool 1.3b49

Returns the value in a json array at the specified index, or returns the value from json object for the specified key.

Usage

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


Examples

  [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.get(a,"b")]
  [h:a=json.fromList("1,44,12")] [json.get(a,1)]

Returns

 44
 44