json.get: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function json.get==
{{MacroFunction
 
|name=json.get
 
|version=1.3b49
 
|description
'''Introduced in MapTool 1.3b49'''
 
Returns the value in a [[Macros:json array|json array]] at the specified index, or returns the value from [[Macros:json object|json object]] for the specified key.
Returns the value in a [[Macros:json array|json array]] at the specified index, or returns the value from [[Macros:json object|json object]] for the specified key.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: jarr = json.get(jarr, index)]
[h: jarr = json.get(jarr, index)]
Line 13: Line 11:
</source>
</source>


 
|example=
===Examples===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.get(a,"b")]
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.get(a,"b")]
Line 23: Line 20:
   44
   44
   44
   44
}}
[[Category:JSON Function]]

Revision as of 02:09, 9 March 2009

json.get() Function

Introduced in version 1.3b49

Usage

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

Example

  [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