JsonParse.getListPerson 也不知道咋实现的,
可能出现的问题,比如中文处理不好,用全英文试试。

解决方案 »

  1.   


    整个Json类public class JsonParse {        /**         * 解析Json数据         *         * @param urlPath         * @return mlists         * @throws Exception         */        public static List<Person> getListPerson(String urlPath) throws Exception {                List<Person> mlists = new ArrayList<Person>();                byte[] data = readParse(urlPath);                JSONArray array = new JSONArray(new String(data));                for (int i = 0; i < array.length(); i++) {                        JSONObject item = array.getJSONObject(i);                        String name = item.getString("name");                        String address = item.getString("address");                        int age = item.getInt("age");                        mlists.add(new Person(name, address, age));                }                return mlists;        }        /**         * 从指定的url中获取字节数组         *         * @param urlPath         * @return 字节数组         * @throws Exception         */        public static byte[] readParse(String urlPath) throws Exception {                ByteArrayOutputStream outStream = new ByteArrayOutputStream();                byte[] data = new byte[1024];                int len = 0;                URL url = new URL(urlPath);                HttpURLConnection conn = (HttpURLConnection) url.openConnection();                InputStream inStream = conn.getInputStream();                while ((len = inStream.read(data)) != -1) {                        outStream.write(data, 0, len);                }                inStream.close();                return outStream.toByteArray();        }}还有就是JSON里面都是英文 
      

  2.   

    用 JSONArrary jarr = new JSONArrary("[ {"id":"01","name":"张三","国籍":“中国”}]"); 试试?
      

  3.   

    JSONArray array = new JSONArray(new String(data));获取的是正确的json格式,或者是你预期的格式吗?
      

  4.   

    这种你要自己写一个adapter,就可以了
      

  5.   

    不是应该通过jsonarray解析吗?