Postman传实体类中有list的json表示格式
实体类:
@Data@AllArgsConstructor@NoArgsConstructorpublicclassOrderData{/**
* 订单ID
*/private String orderId;/**
* 用户ID
*/private String orderUserId;/**
* 用户手机号
*/private String orderUserPhone;/**
* 订单地址
*/private String orderAddress;/**
* 订单用户名
*/private String orderUserName;/**
* 订单状态
*/private String orderState;/**
* 订单总价
*/private BigDecimal orderPrice;/**
* 订单物品信息
*/private List<OrderGoods> orderGoodsList;}@Data@AllArgsConstructor@NoArgsConstructorpublicclassOrderGoods{/**
* 主键
*/private Integer id;/**
* 订单ID
*/private String orderId;/**
* 商品ID
*/private String goodsId;/**
* 订购数量
*/private Integer goodsCount;/**
* 商品价格
*/private BigDecimal goodsPrice;/**
* 商品名称
*/private String goodsName;/**
* 商品图片链接
*/private String goodsImageUrl;}
json格式:
{"orderId":"","orderUserId":"123tt","orderUserPhone":"00000","orderAddress":"ssss","orderUserName":"sss","orderState":"ss","orderPrice":"11222","orderGoodsList":[{"id":"","orderId":"","goodsId":"111","goodsCount":"77","goodsPrice":"77","goodsName":"to7","goodsImageUrl":"to7"},{"id":"","orderId":"","goodsId":"111","goodsCount":"88","goodsPrice":"88","goodsName":"to","goodsImageUrl":"to"}]}
JSON字符串常用的几种格式
1.JSON数值({ “key” : value})
{"key":520,"key1":1314}
2.JSON字符串({ “key” : “value”})
{"key":"我爱你","key1":"一生一世"}
3.JSON数组({ “key” : [value]})
{"key":[520,1314],"key1":[520,3344]}
4.JSON对象({ “key” : {value}})
{"key":{"520":"我爱你"},"key1":{"1314":"一生一世"}}
5.JSON对象数组({ “key” : [{“key1”: “value1”},{“key2”: “value2”}]})
{"我":[{"key":"我爱你"},{"key1":"一生一世"}]}
6.JSON数组对象({“key”:{“key1”:[value1,value2]}})
{"我":{[520,1314],["我爱你","一生一世"]}}
版权归原作者 代码匪徒 所有, 如有侵权,请联系我们删除。