是否可以设计仅返回部分API响应的DTO?

时间:2019-06-06 16:09:51

标签: dto

我正在编写responseDTO,以作为使用Springboot和Java进行API调用的返回。为了简化解释,我简化了api响应,就像下面这样。

{"Summary":{
    "a": 0,
    “b": 1,
    "c": 2,
    "d": 3,
    "e" :4}
}

我的问题是:我可以只用两个键来构造一个DTO,跳过一些键吗?

public class SummaryDto {
  private String a;
  private String b;
}```



I tried, seems it does not work, got empty reponse. Any advice is hugely appreciated! Or if you find some good reference, I would like to read it too!

0 个答案:

没有答案