Difference between revisions of "ObjectType:jsonarray"

From Lavish Software Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
A '''jsonarray''' is a standard [https://www.json.org/ JSON] array.
 
A '''jsonarray''' is a standard [https://www.json.org/ JSON] array.
 +
  
 
== Members ==
 
== Members ==
* ... '''Get['''#''']''': Gets a value stored within this object, by its index (1-based)
+
* ... '''Get['''#''']''': Gets a value stored within this array, by its index (1-based)
 
* ... '''Get['''#''','''valueName2''',...]''': Gets a stored value multiple levels deep within jsonarrays and/or jsonobjects
 
* ... '''Get['''#''','''valueName2''',...]''': Gets a stored value multiple levels deep within jsonarrays and/or jsonobjects
* [[ObjectType:uint|uint]] Size: Allocated capacity of the array
+
* [[ObjectType:uint|uint]] '''Size''': Allocated capacity of the array
* [[ObjectType:uint|uint]] Used: Total number of values currently in the array
+
* [[ObjectType:uint|uint]] '''Used''': Total number of values currently in the array
 +
 
  
 
== Methods ==
 
== Methods ==
 +
* '''ForEach['''code''']''': For each element in the array, performs the specified code. The [[TLO:ForEach|ForEach Top-Level Object]] is used to access the Key or Value for each iteration
 
*'''Clear''': Clears all values from the array
 
*'''Clear''': Clears all values from the array
*'''Set['''#''','''json''']''': Sets a value within the array, to a new JSON value of any type, e.g. <tt>myJsonObject:Set[1,"{\"subValue\":12}"]</tt>
+
*'''Set['''#''','''json''']''': Sets a value within the array, to a new JSON value of any type, e.g. <tt>myJsonArray:Set[1,"{\"subValue\":12}"]</tt>
 +
*'''Add['''json''']''': Adds a value to the end of the array, to a new JSON value of any type, e.g. <tt>myJsonArray:Add["{\"subValue\":12}"]</tt>
 
*'''GetIterator['''jsoniterator''']''': Sets a jsoniterator to iterate this JSON array
 
*'''GetIterator['''jsoniterator''']''': Sets a jsoniterator to iterate this JSON array
 +
*'''Erase['''#''']''': Erases the nth value from the array, shifting later items toward 0
 +
*'''EraseByQuery['''Query ID''']''': Erases items matching the query from the array, shifting later elements toward 0
 +
*'''EraseByQuery['''Query ID''','''bool removeMatches''']''': Erases items either matching or not matching the query from the array (depending on the 2nd parameter), shifting later elements toward 0
 +
  
 
== See Also ==
 
== See Also ==
* [[LavishScript]]
+
{{LavishScript:ObjectType}}
 
 
[[Category:LavishScript]]
 
 
[[Category:JSON]]
 
[[Category:JSON]]

Latest revision as of 14:48, 14 October 2019

Overview

Object Type Vitals
jsonarray
Defined By LavishScript
Inherits ObjectType:jsonvalue
Reduces To same as jsonvalue.AsString
Variable Object Type none
Uses Sub-Types no
C/C++ Type void *

A jsonarray is a standard JSON array.


Members

  • ... Get[#]: Gets a value stored within this array, by its index (1-based)
  • ... Get[#,valueName2,...]: Gets a stored value multiple levels deep within jsonarrays and/or jsonobjects
  • uint Size: Allocated capacity of the array
  • uint Used: Total number of values currently in the array


Methods

  • ForEach[code]: For each element in the array, performs the specified code. The ForEach Top-Level Object is used to access the Key or Value for each iteration
  • Clear: Clears all values from the array
  • Set[#,json]: Sets a value within the array, to a new JSON value of any type, e.g. myJsonArray:Set[1,"{\"subValue\":12}"]
  • Add[json]: Adds a value to the end of the array, to a new JSON value of any type, e.g. myJsonArray:Add["{\"subValue\":12}"]
  • GetIterator[jsoniterator]: Sets a jsoniterator to iterate this JSON array
  • Erase[#]: Erases the nth value from the array, shifting later items toward 0
  • EraseByQuery[Query ID]: Erases items matching the query from the array, shifting later elements toward 0
  • EraseByQuery[Query ID,bool removeMatches]: Erases items either matching or not matching the query from the array (depending on the 2nd parameter), shifting later elements toward 0


See Also

LavishScript Object Types