1.拿到json文件
File file=new File(Constant.SDPATH+json);
String json=FileUtil.getFileString(file);
2.读取解析
public static String getFileString(File file) {
try {
if (!file.exists())
return null;
BufferedReader reader = new BufferedReader(new InputStreamReader(
new FileInputStream(file)));
StringBuilder stringBuilder = new StringBuilder();
for (String line = reader.readLine(); line != null; line = reader
.readLine()) {
stringBuilder.append(line);
}
reader.close();
return stringBuilder.toString().trim();
} catch (IOException e) {
throw new RuntimeException(e);
}
}