json.toStrProp: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Applied Template:MacroFunction)
No edit summary
 
(7 intermediate revisions by 5 users not shown)
Line 2: Line 2:
|name=json.toStrProp
|name=json.toStrProp
|version=1.3b49
|version=1.3b49
|trusted=false
|description=
|description=
Creates a [[Macros:string property list|string list]] from a [[Macros:json object|json object]]. With the specified delimiter, if a delimiter is not provided then the default value of ';' is used.
Creates a [[Macros:string property list|string list]] from a [[JSON Object|json object]] or [[JSON Array|json array]] using the specified delimiter in the result. If a delimiter is not provided then the default value of ';' is used.


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


|example=
|example=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.toStrProp(a)]
   [h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.toStrProp(a)]
   [h:a=json.fromList("a,1,g,4")][r:json.toStrProp(a)]
   [h:a=json.fromList("a,1,g,4")][r:json.toStrProp(a)]
</source>
</syntaxhighlight>


Returns
Returns
<syntaxhighlight lang="mtmacro">
   a=1;c=12;b=44
   a=1;c=12;b=44
   0=a;1=1;2=g;3=4
   0=a;1=1;2=g;3=4
</syntaxhighlight>
}}
}}
[[Category:JSON Function]]
[[Category:JSON Function]] [[Category:String_Property_List_Function]]

Latest revision as of 23:59, 15 March 2023

json.toStrProp() Function

Introduced in version 1.3b49
Creates a string list from a json object or json array using the specified delimiter in the result. If a delimiter is not provided then the default value of ';' is used.

Usage

[h: strProp = json.toStrProp(jobj)]
[h: strProp = json.toStrProp(jobj, delim)]

Parameters

  • jobj - JSON Object or Array
  • delim - Delimiter used in output

Example

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

Returns

  a=1;c=12;b=44
  0=a;1=1;2=g;3=4