json.fromList: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function json.fromList== '''Introduced in MapTool 1.3b49''' Creates a Macros:json array from a Macros:string list. ===Usage=== <source lang="mtmacro" line> [h: jarr = jso...)
 
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Function json.fromList==
{{MacroFunction
|name=json.fromList
|version=1.3b49
|description=
Returns a [[JSON Array]] from a [[String List]].


|usage=
<syntaxhighlight lang="mtmacro" line>
json.fromList(strList)
</syntaxhighlight>
<syntaxhighlight lang="mtmacro" line>
json.fromList(strList, delim)
</syntaxhighlight>
'''Parameters'''
{{param|strList|The [[String List]] that is converted to a [[JSON Array]].}}
{{param|delim|The delimiter used in the [[String List]], defaults to {{code|","}}.}}


|example=
<syntaxhighlight lang="mtmacro" line>
[r:json.fromList("a,1,g,4")]
</syntaxhighlight>
Returns {{code|["a",1,"g",4]}}


'''Introduced in MapTool 1.3b49'''
|also=
 
{{func|json.toList}}
Creates a [[Macros:json array|json array]] from a [[Macros:string list|string list]].
 
===Usage===
<source lang="mtmacro" line>
[h: jarr = json.fromList(strProp)]
</source>
 
 
===Examples===
<source lang="mtmacro" line>
[r:json.fromList("a,1,g,4")]
</source>


Returns
}}
  ["a",1,"g",4]
[[Category:JSON Function]]

Latest revision as of 23:59, 15 March 2023

json.fromList() Function

Introduced in version 1.3b49
Returns a JSON Array from a String List.

Usage

json.fromList(strList)
json.fromList(strList, delim)

Parameters

Example

[r:json.fromList("a,1,g,4")]
Returns ["a",1,"g",4]

See Also