json.toList: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Applied Template:MacroFunction)
No edit summary
 
(8 intermediate revisions by 5 users not shown)
Line 3: Line 3:
|version=1.3b49
|version=1.3b49
|description=
|description=
Creates a [[Macros:string list|string list]] from a [[Macros:json array|json array]]. If the delimiter is not specified then the default value of ',' is used.
Creates a [[Macros:string list|string list]] from a [[JSON Array]]. If the delimiter is not specified then the default value of ',' is used.


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: jarr = json.toList(jarr)]
[h: jarr = json.toList(jarr)]
[h: jarr = json.toList(jarr, delim)]
[h: jarr = json.toList(jarr, delim)]
</source>
</syntaxhighlight>
 
'''Parameters'''
{{param|jarr|JSON Array}}
{{param|delim|Delimiter used in output}}


|examples=
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
   [h:a=json.toList("a,1,g,4")][json.toList(a)]
   [h:a=json.fromList("a,1,g,4")]
</source>
  [json.toList(a)]
</syntaxhighlight>


Returns
Returns
<syntaxhighlight lang="mtmacro">
     a,1,g,4
     a,1,g,4
</syntaxhighlight>
}}
}}
[[Category:JSON Function]]
[[Category:JSON Function]]

Latest revision as of 23:59, 15 March 2023

json.toList() Function

Introduced in version 1.3b49
Creates a string list from a JSON Array. If the delimiter is not specified then the default value of ',' is used.

Usage

[h: jarr = json.toList(jarr)]
[h: jarr = json.toList(jarr, delim)]

Parameters

  • jarr - JSON Array
  • delim - Delimiter used in output

Examples

  [h:a=json.fromList("a,1,g,4")]
  [json.toList(a)]

Returns

     a,1,g,4