String json = ‘{"Uid":600,"Token":"IEJI2WAfvZ5zO2R%2B9UixgI%2BqpCycBChjetJ8GvyozjD","InCome":1270.418,"Balance":39.323,"Withdraw":0.000,"Vip":2,"Discount":0.98,"UsedMax":100,"Point":150.00}’;//假设JSON数据
JSONObject json = new JSONObject(json);//创建json对象
获取Uid数据:
String Uid = json.getString("Uid");
/*
假设数据 {"result":[["书包童","2.06626475206515"],["书包书","2.0837645035829393"],["书包3岁","2.051077240907951"],["书包女潮","1.947316268895617"],["书包男 大学生 双肩包","1.9020810314187229"],["书包男女","2.0647406274330993"],["书包连","2.098981324829216"],["书包有东西送","2.0953794405491983"],["书包撑","2.1000299746828923"],["书包背书","2.1022070629660674"]]}
如果json数据 result是一个数组对象
JSONArray resultarr = json.getJSONArray("result");//这样就拿出result中所有的数据, resultarr.getString(0);//拿出的是 ["书包童","2.06626475206515"] 还是一个数组,所以再来一次转换
JSONArray array = resultarr.getJSONArray(0)// ["书包童","2.06626475206515"] 就变成 array[0] =>书包童 array[11] =>2.06626475206515
String biaoti = resultarr.getString(0);// 0 数组下标 biaoti =>书包童
*/