json.length: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function json.length== '''Introduced in MapTool 1.3b49''' Returns the number of fields in a Macros:json object or number of elements in a Macros:json array. ===Usage=== <...)
 
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function json.length==
{{MacroFunction
 
|name=json.length
 
|version=1.3b49
 
|description
'''Introduced in MapTool 1.3b49'''
 
Returns the number of fields in a [[Macros:json object|json object]] or number of elements in a [[Macros:json array|json array]].
Returns the number of fields in a [[Macros:json object|json object]] or number of elements in a [[Macros:json array|json array]].


 
|usage=
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: len = json.length(jobj)]
[h: len = json.length(jobj)]
Line 14: 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.length(a)]
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [json.length(a)]
Line 24: Line 20:
   3
   3
   4
   4
}}
[[Category:JSON Function]]

Revision as of 02:11, 9 March 2009

json.length() Function

Introduced in version 1.3b49

Usage

[h: len = json.length(jobj)]
[h: len = json.length(jarr)]

Example

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

Returns

 3
4