Answers for "how to read and write data from json file in java"

1

write json string to file in java

// Write JSON string to a file
try (FileWriter file = new FileWriter("fileName.json")) {
  file.write(data); // data is a JSON string here
  file.flush();
} catch (IOException e) {
  e.printStackTrace();
}
Posted by: Guest on October-22-2021

Code answers related to "how to read and write data from json file in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language