Json.ObjectIter

Fields

Name Type Access Description
priv_boolean [bool] r  
priv_int [int] r  
priv_pointer [object] r  

Methods

  init (object)
  next ()

Details

class Json.ObjectIter

An iterator used to iterate over the members of a Json.Object. This must be allocated on the stack and initialised using Json.ObjectIter.init(). The order in which members are returned by the iterator is undefined. The iterator is invalidated if its Json.Object is modified during iteration.

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

New in version 1.2.

init(object)
Parameters:object (Json.Object) – the Json.Object to iterate over

Initialise the self 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.
  }

New in version 1.2.

next()
Returns:True if member_name and member_node are valid; False if the end of the object has been reached
member_name:return location for the member name, or None to ignore
member_node:return location for the member value, or None to ignore
Return type:(bool, member_name: str, member_node: Json.Node)

Advance self and retrieve 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 self is invalid.

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

New in version 1.2.