I want to convert a list of a model that I've defined to String for saving it in Database I know how to do that in Gson but I want to do the same in kotlinx.serialization
Convert a list of a model to String In Gson:
val gson = Gson()
return gson.toJson(data)
Convert the String to the model in Gson:
val listType = object : TypeToken<ArrayList<String>>() {}.type
return Gson().fromJson(string, listType)
How can I do that in kotlinx.serialization?