1. 程式人生 > >Json原生解析

Json原生解析

@Override
            public void requestSuccess(String result) throws Exception {
//                Log.e("qqqqqqqqqqqq",result);
//                JSONObject json=new JSONObject(result);
//                Log.e("111111111111",result);
//                JSONArray jsonArray=json.getJSONArray("data");
//                for (int i=0;i<jsonArray.length();i++) {
//                    JSONObject jsonObject = (JSONObject) jsonArray.get(i);
//                    String goods_img = jsonObject.getString("goods_img");
//                    String goods_name = jsonObject.getString("goods_name");
//                    Person p=new Person();
//                    p.setGoods_img(goods_img);
//                    p.setGoods_name(goods_name);
//                    list.add(p);
//                }
//                Gson gson=new Gson();
//                DataBean dataBean = gson.fromJson(result, DataBean.class);
//                List<Data> list =dataBean.data;
//                mRecyclerView.setAdapter(mAdapter = new HomeAdapter(list));
            }
        });