Java tutorial
//package com.java2s; import android.content.Context; import java.io.IOException; import java.io.InputStream; public class Main { /** * A method to load x.json files from assets folder and convert them * into a string. * * @param c A contect * @param fileName The json file in assets folder which to load json data from * @return */ public static String loadJSONFromAsset(Context c, String fileName) { String json = null; try { InputStream is = c.getAssets().open(fileName); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; } }