错误示范:
$ curl -X POST localhost:8080/employees -H 'Content-type:application/json' -d '{"name": "Samwise Gamgee", "role": "gardener"}'</p>
报错如下:
"JSON parse error: Unexpected character ('n' (code 110)): was expecting double-quote to start field name; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('n' (code 110)): was expecting double-quote to start field name\n at
错误1:curl在windows中是另外一个命令的别名,不是linux中的那个curl。windwos中想要使用原版,需要安装curl,配置环境变量,并改成curl.exe 命令。
错误2:wind powershell 中JOSN单双引号问题。这里需要转义字符。
正确示例:
$ curl.exe -X POST localhost:8080/employees -H 'Content-type:application/json' -d '{\"name\": \"Samwise Gamgee\", \"role\": \"gardener\"}'
- quot double-quote expecting 错误 windowsquot double-quote expecting错误 double-quote unexpected character expecting double-quote quot incompatible expected version jsondecodeerror value expecting quot quot prop defaultexpandall expected closeonclickmodal prop quot expected expected错误token 39 数组prop quot expected 语言编程 线程expected错误