I have a JSON file in my assets folder. That file has one object with an array. The array has 150+ objects with each having three strings.
For each of these 150+ objects
first you need to read the json file from assets , you can use this method
public String readFile(String fileName) throws IOException
{
BufferedReader reader = null;
reader = new BufferedReader(new InputStreamReader(getAssets().open(fileName), "UTF-8"));
String content = "";
String line;
while ((line = reader.readLine()) != null)
{
content = content + line
}
return content;
}
then
String jsonFileContent = readFile("json_in_assets.json");
JSONArray jsonArray = new JSONArray(jsonFileContent);
List persons = new ArrayList<>();
for (int i=0;i