Skip to content

Retrieving array elements from object type iterator. #1367

@kepler425b

Description

@kepler425b

I retrieve an array json::iterator c = itr->find("nodes"); and try to iterate through all arrays in that array (nodes is array that contains arrays):

for (json::iterator ak = c.value().begin(); ak != c.value().end(); ++c)
string id = ak[0].get<string>();

I get error, because those iterators aren't of the same type:
JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));

How should I iterate and access the elements from the iterated array? Couldn't find documentation on this very issue of object to array type iterator mismatch/switch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs more infothe author of the issue needs to provide more details

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions