【发布时间】:2022-01-08 21:50:14
【问题描述】:
我正在序列化 POJO 类的 Json。我想在 Request 中发送空数组,但是当我将 null 或空值传递给 pojo 类中的属性时,我在数组列表中得到 [""] 而不是 []
Expected: "Key": []
But I am getting: "Key":[""]
我的宝:
public class Sample {
private List<String> Key=null;
}
测试数据生成器类:
Sample s = new Sample();
s.Key = ""; // Even if i give null here, i am getting null at the json payload.
请建议以下方法为 Key 构造一个空数组。
{
"Key": []
}
【问题讨论】:
标签: json api selenium automation rest-assured