Я хочу изменить значение от slotList
.C++ JsonCpp Измените объектValue from arrayValue
slotList[1][1] = "1234";
Как решить эту проблему?
Вот что я пробовал:
JSON:
{
"slotList" : [
[ "1452", "1452", "1452", "1452", "1452" ],
[ "1452", "1452", "1452", "1452", "1452" ],
[ "1452", "1452", "1452", "1452", "1452" ],
[ "1452", "1452", "1452", "1452", "1452" ],
[ "1452", "1452", "1452", "1452", "1452" ]
]
}
Код:
if (bIsParsed == true)
{
Json::Value slotList = root["slotList"];
Json::Value slot = slotList[currentIndex];
Json::Value value = "111"; // what is wrong? do not change anything! OMG!
slot[selectIndex].swap(value);
}
Json::StyledWriter writer;
string jsonData = writer.write(root);
Где находится 'currentIndex' и' selectIndex'? –
currentIndex равен 1 и selectIndex равен 1 одинаково :) – realmasse