Bwar / CJsonObject

Ultralightweight JSON parser in C++ based on cJSON
MIT License
648 stars 239 forks source link

请问如何用你这个封装的库创建二维数组 #3

Closed tobetheDuke closed 5 years ago

tobetheDuke commented 5 years ago

类似“test”:[ [{“test”:1}], [{“test”:2}] ]

Bwar commented 5 years ago
neb::CJsonObject oTest;
oTest.AddEmptySubArray("test");
for (int i = 1; i < 3; ++i)
{
    neb::CJsonObject oDimension1;
    neb::CJsonObject oDimension2;
    oDimension2.Add("test", i);
    oDimension1.Add(oDimension2);
    oTest["test"].Add(oDimension1);
}
std::cout << oTest.ToString() << std::endl;