Il file JSON è simile al seguente:Come correggere l'errore JsonCPP da getMemberNames()?
{
"strings": [
{
"key_one": "value_one!"
},
{
"key_two": "value_two!"
},
]
}
Il file C++ è simile al seguente:
Json::Value root;
Json::Reader reader;
bool parsingSuccessful = reader.parse(contents, root);
const Json::Value strings = root["strings"];
std::vector<std::string> list = strings.getMemberNames();
L'errore causato da "strings.getMemberNames()" è:
Assertion failed: (type_ == nullValue || type_ == objectValue), function getMemberNames, file /projects/.../jsoncpp.cpp,
strings
è un arrayValue, l'ho confermato ottenendo il numero ValueType = 6
.
la tua prima risposta era la mia soluzione ideale, ma non riuscivo a scoprire come modificare il mio codice PHP per avere quel formato, ho postato quella domanda qui, nel frattempo, proverò il tuo altro soluzioni :) http://stackoverflow.com/questions/11444171/php-to-json-format –