最近,从我们的日志中,我们看到了:
httpRes status received 400 Bad Request for this linkedinToken AQUz3sCODu312rHNtNfuns3awy0xoUxxxxxxxxxxx.
With Request: {"content":{"submitted-url":"http://mpg.smh.re/2Ra","title":"Gestionnaire sinistre H/F − Belgique ","description":"Responsable de la gestion de dossiers sinistres dans leur intégralité,
vous serez en contact avec de nombreux interlocuteurs (compagnies
d’assurances, clients et bureaux locaux).","submitted-image-url":"http://www.morganphilipsexecutivesearch.com/wp-content/uploads/2014/09/fyte-smarpshare.jpg"},"visibility":{"code":"anyone"},"comment":"FYTE, cabinet de recrutement spécialisé recrute pour l’un de ses clients situé en Belgique un Gestionnaire sinistre H/F."}.
Response body: {
"errorCode": 0,
"message": "Couldn't parse Json body: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: java.io.StringReader@42ea5bc1; line: 1, column: 187]",
"requestId": "0GYQWP14U9",
"status": 400,
"timestamp": 1423490252325
}
```
LinkedIn API说它无法解析JSON体。我们怀疑JAVA JSON解析器不处理字符“é”或“'”。
我的问题是,我们应该注意其他任何特殊/ unicode字符吗?因为这个JSON主体是由Go的内置编组的。
更新:我最近发现“换行”(“CTRL-CHAR,代码10”)是此问题的关键。 “换行”字符出现在“......leurintégralité”之后。我现在的问题是为什么Go内置的JSON marshaller不会处理
答案 0 :(得分:2)
JSON可以处理Unicode字符......前提是它们已正确编码。
但错误信息显示:
Illegal unquoted character ((CTRL-CHAR, code 10))
似乎在说你在JSON中有一个控制字符。 JSON语法声明字符串中不允许使用未转义的控制字符。
现在,如果我们假设10是十进制的,那么它就是一个换行符。所以我会从一开始就在JSON中寻找一个大约187个字符的原始换行符。
我现在的问题是,为什么没有Go内置的JSON编组处理它。
两种可能性: