0
我是Rapidjson的新手,無法找到我想要的。問題是這樣的,說我有一個JSON,它有一個錯誤,不能被解析。然後我想解析另一個json,它可以替換原來的json。但我想要使用相同的rapidjson::Documet
來做到這一點,只要最終我需要在該文檔中解析有效的json。Rapidjson解析另一個JSON如果第一個有錯誤
所以:
rapidjson::Document document;
if (document.Parse<0>("{ \"hello\" : \"wor........ ").HasParseError())
{
// How to parse the correct json "{ \"hello\" : \"world\" }" here
// using the same `document`
}
我應該寫
if (document.Parse<0>("{ \"hello\" : \"wor........ ").HasParseError())
{
document.Parse<0>("{ \"hello\" : \"world\" }");
}