Map<String, Object> productById = restTemplateUtil.getProductsByIds(accountId, clientId, client_type, accessToken, product_id);
System.out.println(productById.get("data"));
List<Map<String,Object> >productList = (List<Map<String, Object>>) productById.get("data"); System.out.println("");
for(Map<String, Object> cartProduct : productList) {
product_id = (String) cartProduct.get("product_id");
String name = (String) cartProduct.get("name");
String familyName = (String) cartProduct.get("familyName");
String imageUrl = (String) cartProduct.get("imageUrl");
int units = (int) cartProduct.get("units");
double unitRate = (double) cartProduct.get("unitRate");
String category = (String) cartProduct.get("category");
double unitDiscountPercent = (double) cartProduct.get("unitDiscountPercent");
int unitGm = (int) cartProduct.get("unitGm");
orders.setProductList(Arrays.asList( product_id, name, familyName, imageUrl,units,unitRate,category,unitDiscountPercent,unitGm)); In this code my Array is insert in database is like that
0: null 1: "Product A" 2: null 3: "image_url" 4: 0 5: 50 6: null 7: 5 8: 250
Я хочу, чтобы это было как 0: object product_id: "5ea0326ab89efb2804690a89" name: "Prodcut A" ImageUrl: "Imageurl"