[英]REST API response modelling on client side - best practices
My application is integrated with some external service and makes requests to that service for data.我的应用程序与一些外部服务集成,并向该服务发出数据请求。 I am just wondering what is the best practice for modelling the responses on the client side, especially in case when client business logic require only some peace of data.
我只是想知道在客户端建模响应的最佳实践是什么,特别是在客户端业务逻辑只需要一些数据的情况下。 I am considering following implementations:
我正在考虑以下实现:
I would do the second.我会做第二个。
converting JSON to class object which contains only those data/properties which are needed for further processing
将 JSON 转换为仅包含进一步处理所需的数据/属性的类对象
It does not make sense to use data which is not needed.使用不需要的数据是没有意义的。 It makes only confusion.
它只会造成混乱。 I would rather use multiple classes.
我宁愿使用多个类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.