File file = new File(Environment.getExternalStorageDirectory(),"news.json");
try {
FileInputStream fileInputStream = new FileInputStream(file);
byte[] bytes = new byte[fileInputStream.available()];
fileInputStream.read(bytes);
string = new String(bytes);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Gson gson = new Gson();
News fromJson = gson.fromJson(string, News.class);
ArrayList<data> data2 = fromJson.getResult().getData();
其中News.class 是一个文件的封装类