rapidjson以其高效獲得很大的使用,在自己的使用中,遇到了一些不知所措的錯誤,在實踐中把自己遇到的問題記錄下來,爲大家解決問題方便。
1.解析string到document
std::string str("{}");
RAPIDJSON_NAMESPACE::Document document;
document.Parse(str.c_str());
if (document.HasParseError())
{
RAPIDJSON_NAMESPACE::ParseErrorCode errCode = document.GetParseError();
}
2.設置Int到document
RAPIDJSON_NAMESPACE::Document document;
document.Parse("{}");
document.AddMember("R", 0, allocator);
是不是很簡單?如果不Parse一次再填寫值,就會報Assert(),IsObject()問題。
待續。。。。。。。