欢迎光临
我们一直在努力

BadRequest

json格式错了吧?json用双引号。。单引号不行哦

?

【报错】:使用POSTMAN调试接口时报以下错误:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2 Final//EN”><title>400 Bad Request</title><h1>Bad Request</h1><p>The browser (or proxy) sent a request that this server could not understand.</p>

【原因】原数据的格式不对,使用了单引号。json格式是用双引号,参考:http://www.w3school.com.cn/json/json_syntax.asp

{‘image’: [‘http://img.redocn.com/sheying/20171024/nongcuntupifangdamen_8843329.jpg’, ‘http://img.redocn.com/sheying/20160926/nongcunlaofang_7139669.jpg’, 便宜美国vps ‘http://img.redocn.com/sheying/20170712/pojiudemingqingmatouqianglaofang_8414233.jpg’, ‘http://img.redocn.com/sheying/20140805/pojiudelaofangzi_2844635.jpg’, ‘http://img.redocn.com/sheying/20171213/wushanhongchuntujiazuxiangpojiudelaowu_9057737.jpg’, ‘http://img.redocn.com/sheying/20161230/pojiudenongcunlaozhaisheying_7713869.jpg’]}

【解决】修改成以下格式就好了

# 缩进是为了好看哈,不影响代码执行结果{“image”: [“http://img.redocn.com/sheying/20171024/nongcuntupifangdamen_8843329.jpg”,”http://img.redocn.com/sheying/20160926/nongcunlaofang_7139669.jpg”, “http://img.redocn.com/sheying/20170712/pojiudemingqingmatouqianglaofang_8414233.jpg”,”http://img.redocn.com/sheying/20140805/pojiudelaofangzi_2844635.jpg”,”http://img.redocn.com/sheying/20171213/wushanhongchuntujiazuxiangpojiudelaowu_9057737.jpg”,”http://img.redocn.com/sheying/20161230/pojiudenongcunlaozhaisheying_7713869.jpg”]}

?

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。