i'm trying to build a simple Android App with Jetpack Compose.
i want to load (JSON) data, stored on the assets folder
[ { "id": 1, "name": "Tiago" } ]
into a String in ViewModel. I'm trying the following
val moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
val jsonAdapter: JsonAdapter<User> = moshi.adapter(User::class.java)
val data = AssetManager.open("users.json").bufferedReader().use { it.readText() }
jsonAdapter.fromJson(data)