json.type: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Macros:Functions:json.type moved to json.type) |
No edit summary |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
|version=1.3b49 | |version=1.3b49 | ||
|description= | |description= | ||
Returns a string which contains the type of | Returns a string which contains the type of JSON variable that is passed in. | ||
Return values are | Return values are | ||
* ARRAY - The object is a [[ | * {{code|ARRAY}} - The object is a [[JSON Array]]. | ||
* OBJECT - The object is a [[ | * {{code|OBJECT}} - The object is a [[JSON Object]]. | ||
* UNKNOWN - It is neither a [[ | * {{code|UNKNOWN}} - It is neither a [[JSON Array]] nor [[JSON Object]]. | ||
| |||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: jarr = json.type(val)] | [h: jarr = json.type(val)] | ||
</ | </syntaxhighlight> | ||
|examples= | |examples= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.type(a)] | [h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.type(a)] | ||
[h:a=json.fromList("a,1,g,4")][r:json.type(a)] | [h:a=json.fromList("a,1,g,4")][r:json.type(a)] | ||
[r:json.type("some thing or other")] | [r:json.type("some thing or other")] | ||
</ | </syntaxhighlight> | ||
Returns | Returns |
Latest revision as of 17:39, 15 March 2023
json.type() Function
• Introduced in version 1.3b49
Returns a string which contains the type of JSON variable that is passed in.
Return values are
ARRAY
- The object is a JSON Array.OBJECT
- The object is a JSON Object.UNKNOWN
- It is neither a JSON Array nor JSON Object.
Usage
[h: jarr = json.type(val)]
Examples
[h:a=json.fromStrProp("a=1;b=44;c=12")] [r:json.type(a)]
[h:a=json.fromList("a,1,g,4")][r:json.type(a)]
[r:json.type("some thing or other")]
Returns
OBJECT ARRAYUNKNOWN