嵌套json 数组结构

发布时间:2023年12月18日
{
 "bills": [
 {
 "billNo": "J2302001",
 "printer": "陈美伶",
 "billDate":"2023-04-18 10:05:23",
 "skuQty": 2,
 "styleQty": 1,
 "totalQty": 2,
 "tagPrintDetails": [
 {
 "colorNo": "102",
 "productCode": "823355",
 "sizeQtys": [
		{
		 "qty": 1,
		 "sizeNo": "07"
 		},
 		{
		 "qty": 1,
		 "sizeNo": "08"
 		}
		 ],
		 "styleNo": "230064"
		 }
		 ],
		 "vendorCode": "A000031",
		 "vendorName": "浙江盈嘉服饰"
		 }
	 ]
}

HashMap<String, Object> outHashMapALL = new HashMap<>();
HashMap<String, Object> outHashMap = new LinkedHashMap<>();
//数据组装json
outHashMap.put(“billNo”, bqdydPush.getBillNo());
outHashMap.put(“printer”, bqdydPush.getPrinter());
outHashMap.put(“billDate”, bqdydPush.getBillDate());
outHashMap.put(“styleQty”, bqdydPush.getStyleQty());
outHashMap.put(“skuQty”, bqdydPush.getSkuQty());
outHashMap.put(“totalQty”, bqdydPush.getTotalQty());
HashMap<String, Object> smallHashMap = new HashMap<>();
smallHashMap.put(“colorNo”,bqdydPushDate.getColorNo());
smallHashMap.put(“styleNo”, bqdydPushDate.getStyleNo());
ArrayList<HashMap<String, Object>> hashMaps = new ArrayList<>();
smallHashMap.put(“productCode”,bqdydPushDate.getProductCode());
HashMap<String, String> smallHashMap2 = new HashMap<>();
smallHashMap2.put(“qty”, String.valueOf(sizeQtys.getQty()));
smallHashMap2.put(“sizeNo”, sizeQtys.getSizeNo());
hashMapsSize.add(smallHashMap2);
smallHashMap.put(“sizeQtys”, hashMapsSize);
hashMaps.add(smallHashMap);
outHashMap.put(“tagPrintDetails”, hashMaps);
outHashMap.put(“vendorCode”, bqdydPush.getVendorCode());
outHashMap.put(“vendorName”, bqdydPush.getVendorName());
listAll.add(outHashMap);
outHashMapALL.put(“bills”,listAll);

文章来源:https://blog.csdn.net/weixin_42164754/article/details/135054693
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。