原生解析json

public static String getJson(String fileName, Context context){
    StringBuilder stringBuilder = new StringBuilder();
    try {
        InputStream is = context.getAssets().open(fileName);
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
        String line;
        while ((line=bufferedReader.readLine()) != null){
            stringBuilder.append(line);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    return stringBuilder.toString();
}
//这个方法需要调用

你可能感兴趣的:(原生解析json)