我的控制器中有此dto请求
@Data
public class OldTransactionFilterDto {
List<Long> ids;
List<Integer> depositConfirmationNumbers;
List<Long> lenderIds;
LocalDate transactionDateFrom;
LocalDate transactionDateTo;
List<TransactionTypes> types;
Integer offset;
Integer limit;
}
我要在邮递员中尝试的json请求看起来像这样
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
{"types" : ["Morgage"]},
"offset" : 1,
"limit" : 1
}
TransactionTypes是仅具有一个值的枚举。在这个json中,邮递员说我的Types值有错误Bad String。
答案 0 :(得分:1)
那么JSON无效
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
{"types" : ["Morgage"]} --->here!,
"offset" : 1,
"limit" : 1
}
它必须写为
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
"types" : ["Morgage"],
"offset" : 1,
"limit" : 1
}
正确设置JSON,错误将消失!