json.contains: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function json.contains== '''Introduced in MapTool 1.3b49''' Returns 1 if the json object contains the specified key. ===Usage=== <source lang="mtmacro" line> ...)
 
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function json.contains==
{{MacroFunction
 
|name=json.contains
 
|version=1.3b49
 
|description
'''Introduced in MapTool 1.3b49'''
 
Returns 1 if the [[Macros:json object|json object]] contains the specified key.
Returns 1 if the [[Macros:json object|json object]] contains the specified key.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: value = json.contains(jobj, key)]
[h: value = json.contains(jobj, key)]
</source>
</source>


 
|examples=
===Examples===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.contains(a,"b")]
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.contains(a,"b")]
Line 22: Line 19:
   1
   1
   0
   0
}}
[[Category:JSON Function]]

Revision as of 02:01, 9 March 2009

json.contains() Function

Introduced in version 1.3b49

Usage

[h: value = json.contains(jobj, key)]

Examples

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

Returns

  1
0