GenericJsonIterator
This class provides a mechanism for iterating over the elements of a JSON array. It maintains a reference to the underlying data and tracks the current traversal position using an internal index.
Attributes
| Attribute | Type | Description |
|---|---|---|
| array | JsonArray | The underlying JSON array structure being traversed during iteration. |
| index | usize | The current numerical position within the array used to track progress and retrieve the next element. |
Constructor
Signature
def GenericJsonIterator(
array: JsonArray< 'data >,
index: usize
)
Parameters
| Name | Type | Description |
|---|---|---|
| array | JsonArray< 'data > | The JSON array to iterate over. |
| index | usize | The starting index for the iterator. |
Signature
def GenericJsonIterator(
array: JsonArray,
index: int = 0
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| array | JsonArray | The JSON array object containing the data to be iterated over |
| index | int = 0 | The starting position within the array for the iteration process |
Methods
__next__()
def __next__() - > Any
Retrieves the next element from the JSON array and increments the internal cursor.
Returns
| Type | Description |
|---|---|
Any | The JSON value at the current index, or raises StopIteration if the end of the array is reached |
__iter__()
def __iter__() - > [GenericJsonIterator](genericjsoniterator.md?sid=input_return_enums_genericjsoniterator)
Returns the iterator instance itself to support the standard Python iteration protocol.
Returns
| Type | Description |
|---|---|
[GenericJsonIterator](genericjsoniterator.md?sid=input_return_enums_genericjsoniterator) | The current iterator instance |