简单的一个数组形式的JSON文件参考http://www.cocoachina.com/bbs/read.php?tid=186210
确实能解析出来,但是关于多层级的JSON文件,该怎么解析呢??
求高手赐教

多层的看内容是什么,这个其实还是rapidjson解析库的使用问题了。多层的话只是字典嵌套字典或者嵌套数组。只需将值转成一个字典或者数据对象即可。
先贴上我的JSON结构,我的代码如下:
bool bRet = false;
unsigned long size = 0;
unsigned char pBytes = NULL;
rapidjson::Document _doc;
do {
pBytes = cocos2d::CCFileUtils::sharedFileUtils()->getFileData(fileName, “r”, &size);
CC_BREAK_IF(pBytes == NULL || strcmp((char)pBytes, “”) == 0);
std::string load_str((const char*)pBytes, size);
CC_SAFE_DELETE_ARRAY(pBytes);
_doc.Parse<0>(load_str.c_str());
CC_BREAK_IF(_doc.HasParseError());
if (_doc.IsObject() && _doc.HasMember("widgetTree"))
{
const rapidjson::Value &Array_1 = _doc"widgetTree"];
if (Array_1.IsObject() && Array_1.HasMember("children"))
{
const rapidjson::Value &Array_2 = _doc"children"];
if (Array_2.IsObject())
{
const rapidjson::Value &Array_3 = _doc"children"];
}
}
}
bRet = true;
} while (0);
return bRet;
为什么在我解析到 Array_2的时候,它即不是数组也不是 Object 了呢??