Description

The member functions begin() and end() return STL-style iterators. You can use these iterators to enumerate all the key-value pairs in the object pointed by the JsonObjectConst.

These functions reproduce the containers in the C++ Standard Library and allow you to use the “ranged-based for loop” feature of C++11.

Signatures

JsonObjectConst::iterator begin() const;
JsonObjectConst::iterator end() const;

Return value

begin() returns an iterator to the first key-value pair of the object.

end() returns an iterator to the element after the last. This iterator must not be dereferenced; it’s a placeholder to detect the end of the object.

JsonObjectConst::iterator points to a JsonPairConst, a class that bundles a key (accessible via JsonPair::key()) and a value (accessible via JsonPair::value()).

The type of the key is JsonString; you need to call JsonString::c_str() to get the char-pointer out of it. The type of the value is JsonVariantConst.

Here is a summary:

class JsonPairConst {
public:
  JsonString key() const;
  JsonVariantConst value() const;
};

class JsonString {
public:
  const char* c_str() const;
};

See also