如题:使用postman时发现传递包含list的属性的对象就会报400错误: HTTP Status 400 – Bad Request Type Status Report Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
自定义json格式如下: {
"abc" : "12341234",
"test" : "2342345",
"url" : "",
"aaa" : "#b709de",
"lstMessage" :
[
{
"name" : "first",
"value" : "惺惺惜惺惺",
"color" : "#FF3333"
},
{
"name" : "proName",
"value" : "柔柔弱弱人",
"color" : "#0044BB"
},
{
"name" : "price",
"value" : "99",
"color" : "#0044BB"
},
{
"name" : "priceTime",
"value" : "2018年08月17日",
"color" : "#000"
},
{
"name" : "remark",
"value" : "如有其它问题,请咨询电话:400-8888-888",
"color" : "#000"
}
]
}
出现这个错误的原因除去类型转换的异常,还有一个非常重要,就是需要对象声明出:默认的构造函数 ,这个非常重要!!! list中如果还是一个对象那么该对象同样需要声明出:默认的构造函数,不然同样报错!!!至此问题终于解决了!!!
|