the json is prettier
parent
45a9304c41
commit
1430821849
|
@ -663,13 +663,14 @@ fun chargerDonneesDepuisFichier(): List<Mot> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val json = Json { prettyPrint = true }
|
||||||
|
|
||||||
fun sauvegarderDonneesDansFichier(listeMots: List<Mot>) {
|
fun sauvegarderDonneesDansFichier(listeMots: List<Mot>) {
|
||||||
try {
|
try {
|
||||||
val content = Json.encodeToString(listeMots)
|
val content = json.encodeToString(listeMots)
|
||||||
File("glossaire.json").writeText(content)
|
File("glossaire.json").writeText(content)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
// Handle the exception as needed
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue