Postman传实体类中有list的json表示格式
实体类:
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderData {
/**
* 订单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
@NoArgsConstructor
public class OrderGoods {
/**
* 主键
*/
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”}]})文章来源:https://www.toymoban.com/news/detail-524169.html
{
"我" : [
{"key": "我爱你"},
{"key1": "一生一世"}
]
}
6.JSON数组对象({“key”:{“key1”:[value1,value2]}})文章来源地址https://www.toymoban.com/news/detail-524169.html
{
"我" : {
[520,1314],
["我爱你", "一生一世"]
}
}
到了这里,关于Postman传参的JSON格式的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!