Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

access to object array

flashpixx
2012-07-06
2013-04-22
  • flashpixx
    flashpixx
    2012-07-06

    Hello,

    I try to read the trend values of twitter (see https://api.twitter.com/1/trends/daily.json )
    I have got access to the "list" of the trends values (eg items with the object name "2012-07-06 10:00").

    This is a short code excerpt:

    Json::Value l_trends = l_resultroot["trends"];
    for(std::size_t i=0; i < l_trends.size(); ++i) {
         do something on each "date object"
    }
    

    If I try to get access with

    l_trends[i]
    

    I get the assertion error:
    Assertion failed: (type_ == nullValue || type_ == arrayValue), function operator, file src/lib_json/json_value.cpp, line 977.

    In which way can I get access to the "date objects" ?
    Thanks

     
  • flashpixx
    flashpixx
    2012-07-06

    the second code line should be

    l_trends[i]
    
     
  • flashpixx
    flashpixx
    2012-07-06

    sorry, I must add some spaces in the code line, because otherwise the index operator is removed

    l_trend [ i ]
    
     
  • RDS
    RDS
    2012-07-09

    trends seems to be "Object Type". Use Json::ValueIterator for iterating over individual member/entry in the object.