Difference between revisions of "ObjectType:jsonobject"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
A '''jsonobject''' is a standard [https://www.json.org/ JSON] object. | A '''jsonobject''' is a standard [https://www.json.org/ JSON] object. | ||
+ | |||
== Members == | == Members == | ||
* ... '''Get['''valueName''']''': Gets a value stored within this object, by its name | * ... '''Get['''valueName''']''': Gets a value stored within this object, by its name | ||
* ... '''Get['''valueName''','''valueName2''',...]''': Gets a stored value multiple levels deep within jsonobjects and/or jsonarrays | * ... '''Get['''valueName''','''valueName2''',...]''': Gets a stored value multiple levels deep within jsonobjects and/or jsonarrays | ||
− | * bool '''Has['''valueName''']''': Checks whether a value is stored within this object, by its name | + | * [[ObjectType:bool|bool]] '''Has['''valueName''']''': Checks whether a value is stored within this object, by its name |
− | * bool '''Has['''valueName''','''valueName2''',...]''': Checks whether a value is stored, multiple levels deep within jsonobjects and/or jsonarrays | + | * [[ObjectType:bool|bool]] '''Has['''valueName''','''valueName2''',...]''': Checks whether a value is stored, multiple levels deep within jsonobjects and/or jsonarrays |
− | * bool '''Assert['''valueName''','''json''']''': Checks whether a value is stored within this object AND matches the specified JSON value | + | * [[ObjectType:bool|bool]] '''Assert['''valueName''','''json''']''': Checks whether a value is stored within this object AND matches the specified JSON value |
− | * bool '''Assert['''valueName''','''valueName2''',...,'''json''']''': Checks whether a value is stored, multiple levels deep within jsonobjects and/or jsonarrays, AND matches the specified JSON value | + | * [[ObjectType:bool|bool]] '''Assert['''valueName''','''valueName2''',...,'''json''']''': Checks whether a value is stored, multiple levels deep within jsonobjects and/or jsonarrays, AND matches the specified JSON value |
+ | * [[ObjectType:jsonarray|jsonarray]] '''Keys''': A JSON array containing a list of keys from this object | ||
+ | * [[ObjectType:jsonarray|jsonarray]] '''Values''': A JSON array containing a list of values from this object | ||
+ | |||
== Methods == | == Methods == | ||
+ | * '''ForEach['''code''']''': For each value in the object, 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 object | *'''Clear''': Clears all values from the object | ||
*'''Set['''valueName''','''json''']''': Sets a value within the object, to a new JSON value of any type, e.g. <tt>myJsonObject:Set["someObject","{\"subValue\":12}"]</tt> | *'''Set['''valueName''','''json''']''': Sets a value within the object, to a new JSON value of any type, e.g. <tt>myJsonObject:Set["someObject","{\"subValue\":12}"]</tt> | ||
Line 19: | Line 24: | ||
*'''EraseByQuery['''Query ID''']''': Erases items matching the query from the object | *'''EraseByQuery['''Query ID''']''': Erases items matching the query from the object | ||
*'''EraseByQuery['''Query ID''','''bool removeMatches''']''': Erases items either matching or not matching the query from the object (depending on the 2nd parameter) | *'''EraseByQuery['''Query ID''','''bool removeMatches''']''': Erases items either matching or not matching the query from the object (depending on the 2nd parameter) | ||
+ | |||
== See Also == | == See Also == | ||
{{LavishScript:ObjectType}} | {{LavishScript:ObjectType}} | ||
[[Category:JSON]] | [[Category:JSON]] |
Latest revision as of 14:48, 14 October 2019
Contents
Overview
jsonobject | |
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 jsonobject is a standard JSON object.
Members
- ... Get[valueName]: Gets a value stored within this object, by its name
- ... Get[valueName,valueName2,...]: Gets a stored value multiple levels deep within jsonobjects and/or jsonarrays
- bool Has[valueName]: Checks whether a value is stored within this object, by its name
- bool Has[valueName,valueName2,...]: Checks whether a value is stored, multiple levels deep within jsonobjects and/or jsonarrays
- bool Assert[valueName,json]: Checks whether a value is stored within this object AND matches the specified JSON value
- bool Assert[valueName,valueName2,...,json]: Checks whether a value is stored, multiple levels deep within jsonobjects and/or jsonarrays, AND matches the specified JSON value
- jsonarray Keys: A JSON array containing a list of keys from this object
- jsonarray Values: A JSON array containing a list of values from this object
Methods
- ForEach[code]: For each value in the object, 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 object
- Set[valueName,json]: Sets a value within the object, to a new JSON value of any type, e.g. myJsonObject:Set["someObject","{\"subValue\":12}"]
- GetIterator[jsoniterator]: Sets a jsoniterator to iterate this JSON object
- Erase[valueName]: Erases the specified value from the object
- EraseByQuery[Query ID]: Erases items matching the query from the object
- EraseByQuery[Query ID,bool removeMatches]: Erases items either matching or not matching the query from the object (depending on the 2nd parameter)
See Also
LavishScript Object Types
- Text
- string - mutablestring - unistring
- Numbers
- byte - float - float64 - int - uint - int64
- Boolean (TRUE/FALSE)
- bool
- Pointers
- boolptr - byteptr - floatptr - float64ptr - intptr - uintptr - int64ptr - rgbptr - stringptr
- Containers
- objectcontainer - array - index - collection - queue - stack - set - variablescope
- JSON
- jsonobject - jsonarray - jsonvaluecontainer - jsonvalue
- Iteration
- iterator - jsoniterator
- Date/Time
- time
- File Handling
- filepath - file - filelist - filelistentry
- Tasks
- lavishmachine - Accessed via the Top-Level Object LMAC
- task - tasklibrary - taskmanager - tasktype - taskpulseargs - elmactaskstate