json.fromList: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Correcting JSON Array link.)
m (Added delim parameter.)
Line 3: Line 3:
|version=1.3b49
|version=1.3b49
|description=
|description=
Creates a [[JSON Array]] from a [[Macros:string list|string list]].  
Returns a [[JSON Array]] from a [[String List]].  


|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: jarr = json.fromList(strProp)]
json.fromList(strList)]
</source>
</source>
<source lang="mtmacro" line>
json.fromList(strList, delim)]
</source>
'''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=
|example=
Line 14: Line 20:
[r:json.fromList("a,1,g,4")]
[r:json.fromList("a,1,g,4")]
</source>
</source>
Returns {{code|["a",1,"g",4]}}
|also=
{{func|json.toList}}


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

Revision as of 09:52, 28 April 2009

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