EVE:[globbing] unmatched close brace/bracket in column 6

根据官方教程,在命令行中使用curl执行下面命令:

curl -d '[{"firstname": "barack", "lastname": "obama"}, {"firstname": "mitt", "lastname": "romney"}]' -H 'Content-Type: application/json'  http://127.0.0.1:5000/people

出现了如下错误:

curl: (6) Could not resolve host: barack,
curl: (6) Could not resolve host: lastname
curl: (3) [globbing] unmatched close brace/bracket in column 6
curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: mitt,
curl: (6) Could not resolve host: lastname
curl: (3) [globbing] unmatched close brace/bracket in column 7
curl: (6) Could not resolve host: application
{"_status": "ERR", "_issues": {"'[{firstname:": "unknown field", "lastname": "required field"}, "_error": {"code": 422, "message": "Insertion failure: 1 document(s) contain(s) error(s)"}}

原因是由于我使用的是windows系统,而window的command.exe似乎不支持单引号,所以只要将其中的单引号改为双引号,并转义字符串中的任何双引号

curl -d "[{\"firstname\": \"barack\", \"lastname\": \"obama\"}, {\"firstname\": \"mitt\", \"lastname\": \"romney\"}]" -H "Content-Type: application/json" http://127.0.0.1:5000/people

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值