Array (Json function): Difference between revisions
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Json:Array subtitle}} | {{Template:Json:Array subtitle}} | ||
This | This function creates a Json object of the array type. | ||
==Syntax== | ==Syntax== | ||
{{Template:Json:Array syntax}} | {{Template:Json:Array syntax}} | ||
Line 14: | Line 14: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | |||
<li>If the array is to be dynamically populated, it might be easiest to simply specify Array with no parameters and ad items with the [[Add (Json function)|Add function]].</li> | |||
<li>The added Json objects can be a mix of Json object types.</li> | |||
</ul> | |||
==Examples== | ==Examples== | ||
The following example creates a Json array whose items are a number, a boolean, a string, a null, and an object: | |||
<p class="code">%json is object json | |||
... | |||
%json = array(23.14069, false, "Gelfond", null, object) | |||
</p> | |||
==See also== | ==See also== | ||
{{Template:Json:Array footer}} | {{Template:Json:Array footer}} |
Latest revision as of 21:15, 17 February 2015
Create an Array JSON object (Json class)
[Introduced in Model 204 7.6]
This function creates a Json object of the array type.
Syntax
%json = [%(Json):]Array[( [itemList])]
Syntax terms
%json | Json object |
---|---|
[%(Json):] | The optional class name in parentheses denotes a virtual constructor. See "Usage notes", below, for more information about invoking a virtual constructor. |
itemList | Zero or more Json objects (including null) that become the arrays original items. |
Usage notes
- If the array is to be dynamically populated, it might be easiest to simply specify Array with no parameters and ad items with the Add function.
- The added Json objects can be a mix of Json object types.
Examples
The following example creates a Json array whose items are a number, a boolean, a string, a null, and an object:
%json is object json ... %json = array(23.14069, false, "Gelfond", null, object)