Class (GI Struct)

Json-1.0JsonObjectIterSince 1.2

An iterator object used to iterate over the members of a JSON object.

Json.ObjectIter must be allocated on the stack and initialised using Json.ObjectIter.init or Json.ObjectIter.init_ordered.

The iterator is invalidated if the object is modified during iteration.

All the fields in the Json.ObjectIter structure are private and should never be accessed directly.

1.2

Index

Constructors

Properties

Methods

Constructors

Properties

$gtype: GType<ObjectIter>

Methods

  • Initialises the iter and associate it with object.

    JsonObjectIter iter;
    const gchar *member_name;
    JsonNode *member_node;

    json_object_iter_init (&iter, some_object);
    while (json_object_iter_next (&iter, &member_name, &member_node))
    {
    // Do something with `member_name` and `member_node`.
    }

    The iterator initialized with this function will iterate the members of the object in an undefined order.

    See also: Json.ObjectIter.init_ordered

    Parameters

    • object: Json.Object

      the JSON object to iterate over

    Returns void

  • Initialises the iter and associate it with object.

    JsonObjectIter iter;
    const gchar *member_name;
    JsonNode *member_node;

    json_object_iter_init_ordered (&iter, some_object);
    while (json_object_iter_next_ordered (&iter, &member_name, &member_node))
    {
    // Do something with `member_name` and `member_node`.
    }

    See also: Json.ObjectIter.init

    Parameters

    • object: Json.Object

      the JSON object to iterate over

    Returns void

  • Advances the iterator and retrieves the next member in the object.

    If the end of the object is reached, FALSE is returned and member_name and member_node are set to invalid values. After that point, the iter is invalid.

    The order in which members are returned by the iterator is undefined. The iterator is invalidated if the object is modified during iteration.

    You must use this function with an iterator initialized with Json.ObjectIter.init; using this function with an iterator initialized with Json.ObjectIter.init_ordered yields undefined behavior.

    See also: Json.ObjectIter.next_ordered

    Returns [boolean, string, Json.Node]

    TRUE if member_name and member_node are valid; FALSE if there are no more members

  • Advances the iterator and retrieves the next member in the object.

    If the end of the object is reached, FALSE is returned and member_name and member_node are set to invalid values. After that point, the iter is invalid.

    The order in which members are returned by the iterator is the same order in which the members were added to the Json.Object. The iterator is invalidated if its Json.Object is modified during iteration.

    You must use this function with an iterator initialized with Json.ObjectIter.init_ordered; using this function with an iterator initialized with Json.ObjectIter.init yields undefined behavior.

    See also: Json.ObjectIter.next

    Returns [boolean, string, Json.Node]

    TRUE if member_name and member_node are valid; FALSE if the end of the object has been reached