public static List<Product> getCartList() { JSonObject responseDetailsJson = new JSonObject(); JSonArray jsonArray = new JSonArray(); List<Product> cartList = new Vector<Product>(cartMap.keySet().size()); for(Product p : cartMap.keySet()) { cartList.add(p); JSonObject formDetailsJson = new JSonObject(); formDetailsJson.put("id", "1"); formDetailsJson.put("name", "name1"); jsonArray.add(formDetailsJson); } responseDetailsJson.put("forms", jsonArray);//Here you can see the data in json format return cartList;}
您可以通过以下形式获取数据
{ "forms": [ { "id": "1", "name": "name1" }, { "id": "2", "name": "name2" } ]}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)