Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to create json file in android programmatically

public void save(Context context, String jsonString) throws IOException {
  File rootFolder = context.getExternalFilesDir(null);
  File jsonFile = new File(rootFolder, "file.json");
  FileWriter writer = new FileWriter(jsonFile);
  writer.write(jsonString);
  writer.close();
  //or IOUtils.closeQuietly(writer);
}
 
PREVIOUS NEXT
Tagged: #create #json #file #android #programmatically
ADD COMMENT
Topic
Name
4+2 =