📜  在java代码示例中将json字符串写入文件

📅  最后修改于: 2022-03-11 14:52:40.153000             🧑  作者: Mango

代码示例1
// 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();
}