我有一个REST API,它返回一个带有文件元数据的字符串。在这些文件中,我有一个名称中包含“”(0xEF0xBF0xBF,link)字符的文件。当我尝试解析这样的反应,我得到异常,说:C++ REST SDK,解析包含(0xEF 0xBF 0xBF)字符的JSON
e = {_message="* Line 1, Column 13 Syntax error: Malformed string literal" }
这是我试图解析字符串:
{“文件”:[“霹雳千兆以太网适配器.TXT “[ ”bc288518-c426-4dbd-9600-a213a35d1c04“,1447772221866,9 ”的Bartosz“, ”Siewior“]],[ ”System.Windows.Interactivity.dll“,[” 56ce759b-019B-4723- 8fca-7af877908971" ,1440507238241,55904 “的Bartosz”, “Siewior”]]], “folderPermission”:[[ “修改”]], “目录”:[]}
我的代码运用接收并解析字符串:
// ...
client.request(request).then([&](web::http::http_response response) {
status_code = response.status_code();
//response.extract_json(true).then([&](pplx::task<web::json::value> previousTask) {
response.extract_string().then([&](pplx::task<utility::string_t> previousTask) {
try {
utility::string_t str_response = previousTask.get();
web::json::value root;
root = web::json::value::parse(str_response);
}
catch (const web::http::http_exception& e) {
std::wstringstream ss;
ss << e.what();
str_response = ss.str();
}
catch (const web::json::json_exception& e) {
std::wstringstream ss;
ss << e.what();
str_response = ss.str();
}
TaskExecutionData data = { task.id, status_code, str_response.c_str() };
callback(data);
}).wait();
}).wait();
VS2013 JSON展示台解析和显示正确结果:VS_json_visualizer
我已经试过C++ REST版本2.5.0和2.6.0,他们都没有是能够解析该字符串...你有任何ides?从卡萨布兰卡的团队