This tutorial shows you ways to write to File in Kotlin using
BufferedWriter or Kotlin extension functions such as
write(). You’ll also know how to write Kotlin objects/JSON to a file.
– How to read File in Kotlin
– Kotlin – Convert object to/from JSON string using Gson