c++ - jsoncpp iteraror of members of a Value -


i'm going through json file following code:

for (itr = root.begin(); itr != root.end(); itr++){ cout<< "key: "<<itr.key().tostyledstring() << endl;} 

i found memmbers of object @ end program crash. think iterator try move outside end of object, not sure. found piece of code in many examples think should work fine. error? file i'm tring read:

{"lon": [10.6635,10.664510],"lat": [44.144,44.1450101],"range": [0,10.1010101,20.2020202]} 

this complete code example works fine me:

json::value root(json::objectvalue); json::reader reader; reader.parse("{\"lon\": [10.6635,10.664510],\"lat\": [44.144,44.1450101],\"range\": [0,10.1010101,20.2020202]}", root, false);  std::string output; (json::valueiterator itr = root.begin(); itr != root.end(); itr++)     output += "key: " + itr.key().tostyledstring(); 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -