1. 如果JSON對象中有屬性是包含雙引號的,比如
復制代碼 代碼如下:
{
"description": "25""
}
復制代碼 代碼如下:
void string_to_json_string(std::string const& str, std::string & json_str) {
std::stringstream ss;
for (size_t i = 0; i < str.length(); ++i) {
if (str[i] == '"') {
ss << '//' << '/"';
} else {
ss << str[i];
}
}
json_str = ss.str();
}
復制代碼 代碼如下:
removeDoubleQuotes: function(str) {
return str.replace("/"", "http:///"");
},
新聞熱點
疑難解答
圖片精選