json.array
Module for [Array] class
class Array
Types 1
classArray : gobject.boxed.Boxed
json.array.Array is the representation of the array type inside JSON.
A json.array.Array contains json.node.Node elements, which may contain fundamental types, other arrays or objects.
Since arrays can be arbitrarily big, copying them can be expensive; for this reason, they are reference counted. You can control the lifetime of a json.array.Array using json.array.Array.ref_ and json.array.Array.unref.
To append an element, use json.array.Array.addElement.
To extract an element at a given index, use json.array.Array.getElement.
To retrieve the entire array in list form, use json.array.Array.getElements.
To retrieve the length of the array, use json.array.Array.getLength.
Methods
json.array.Array sizedNew(uint nElements) static nothrowCreates a new array with `n_elements` slots already allocated.void addArrayElement(json.array.Array value = null) nothrowConveniently adds an array element into an array.void addDoubleElement(double value) nothrowConveniently adds the given floating point value into an array.void addObjectElement(json.object.ObjectWrap value = null) nothrowConveniently adds an object into an array.json.node.Node dupElement(uint index) nothrowRetrieves a copy of the element at the given position in the array.void foreachElement(json.types.ArrayForeach func) nothrowIterates over all elements of an array, and calls a function on each one of them.json.array.Array getArrayElement(uint index) nothrowConveniently retrieves the array at the given position inside an array.bool getBooleanElement(uint index) nothrowConveniently retrieves the boolean value of the element at the given position inside an array.double getDoubleElement(uint index) nothrowConveniently retrieves the floating point value of the element at the given position inside an array.json.node.Node getElement(uint index) nothrowRetrieves the element at the given position in the array.json.node.Node[] getElements() nothrowRetrieves all the elements of an array as a list of nodes. Returns: the elements of the arraylong getIntElement(uint index) nothrowConveniently retrieves the integer value of the element at the given position inside an array.bool getNullElement(uint index) nothrowConveniently checks whether the element at the given position inside the array contains a `null` value.json.object.ObjectWrap getObjectElement(uint index) nothrowConveniently retrieves the object at the given position inside an array.string getStringElement(uint index) nothrowConveniently retrieves the string value of the element at the given position inside an array.bool isImmutable() nothrowCheck whether the given `array` has been marked as immutable by calling [json.array.Array.seal] on it. Returns: true if the array is immutable