json.fromStrProp: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function json.fromStrProp== {{TrustedOnlyFunction}} '''Introduced in MapTool 1.3b49''' Creates a Macros:json object from a Macros:string property list. ===Usage=== <source...)
 
No edit summary
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==Function json.fromStrProp==
{{MacroFunction
{{TrustedOnlyFunction}}
|name=json.fromStrProp
|version=1.3b49
|description=
Creates a [[JSON Object|json object]] from a [[Macros:string property list|string property list]].


|usage=
<syntaxhighlight lang="mtmacro" line>
json.fromStrProp(propList)
json.fromStrProp(propList,delim)
</syntaxhighlight>
'''Parameters'''
{{param|propList|String property list to extract data from.}}
{{param|delim|Delimiter between fields (default is {{code|";"}}).}}


'''Introduced in MapTool 1.3b49'''
|example=
 
<syntaxhighlight lang="mtmacro" line>
Creates a [[Macros:json object|json object]] from a [[Macros:string property list|string property list]].
 
===Usage===
<source lang="mtmacro" line>
[h: jobj = json.fromStrProp(strProp)]
</source>
 
 
===Examples===
<source lang="mtmacro" line>
[r:json.fromStrProp("a=1;b=44;c=12")]
[r:json.fromStrProp("a=1;b=44;c=12")]
</source>
</syntaxhighlight>


Returns
Returns
   {"a":1,"c":12,"b":44}
   {"a":1,"c":12,"b":44}
}}
[[Category:JSON Function]]

Latest revision as of 17:46, 15 March 2023

json.fromStrProp() Function

Introduced in version 1.3b49

Usage

json.fromStrProp(propList)
json.fromStrProp(propList,delim)

Parameters

  • propList - String property list to extract data from.
  • delim - Delimiter between fields (default is ";").

Example

[r:json.fromStrProp("a=1;b=44;c=12")]

Returns

{"a":1,"c":12,"b":44}