profile
viewpoint

Ask questionsjson解析报Invalid encoding in string

您好~ 解析如下json字符串时,出现错误,其错误信息为Invalid encoding in string. char szData[] = "{"url":"http://www.baidu.com/api/dbAudit/user=dasfdffffdf","req_ip":"192.168.1.80","req_param":"CONTENT-TYPE:application/json\r\nUSER-AGENT:PostmanRuntime/7.26.2\r\nACCEPT:/\r\nCACHE-CONTROL:no-cache\r\nPOSTMAN-TOKEN:91c63247-8204-4eb7-abcf-5531a10f7d3d\r\nHOST:www.baidu.com\r\nACCEPT-ENCODING:gzip, deflate, br\r\nCONNECTION:keep-alive\r\nCONTENT-LENGTH:82\r\nCOOKIE:BAIDUID=EE139BCEEF9632770EA40D37E3DBC073:FG=1; BIDUPSID=EE139BCEEF963277CB41AFAD9A7BA212; PSTM=1595314154; H_PS_PSSID=1467_31671_32046_32231_32115_31321; BDSVRTM=0; BD_HOME=1\r\n","req_time":"2020-08-05 01:50:31","req_body":{"idNumber":["999993221223912","231313131112412"],"mobile":["13131311124","13131112412"],"driverLicenseNumber":["144142223","142223131"]}}";

if (doc.ParseInsitu(szData).HasParseError()) { ERROR("json 解析失败{}:{}", doc.GetErrorOffset(), GetParseError_En(doc.GetParseError())); return -1; }

使用在线工具转换能够转换成功

Tencent/rapidjson

Answer questions miloyip

上面的不是合法的代码,要么传一个 .json 文件吧。

useful!

Related questions

是否支持流式解析以及多个json分离解析 hot 1
是否支持流式解析以及多个json分离解析 hot 1
RapidJSON causes cc1plus: internal compiler error: Segmentation fault - rapidjson hot 1
GenericMemberIterator::Iterator implicitly declared private when RAPIDJSON_NOMEMBERITERATORCLASS is defined hot 1
Always gets a core dump while creating json string (rapidjson) hot 1
Bazel Support hot 1
Syntax typo in tutorial hot 1
是否支持流式解析以及多个json分离解析 hot 1
作者你好,我 想请教一下,这个框架是否能够将变量中文stirng 转成wchar_t? 在文档只看到定量 hot 1
travis on windows hot 1
Added headers to my project and got thousands of errors hot 1
Added headers to my project and got thousands of errors hot 1
想要的反斜杠 \. 无法表示,否则JSON解析出错 hot 1
Assertion `stack_.GetSize() == sizeof(ValueType)' failed hot 1
source:https://uonfu.com/
Github User Rank List