@Mananpoddarm kotlinx.serialization doesn't work with data classes only. Although your JSON file is already modeled as data, and a data class would be grate. Assume, you have this json file
{
"name": "Mananpoddarm",
"language": "kotlin",
"platforms": [
"js",
"jvm",
"native",
"android"
]
}
You'll have to crate a class (a normal or a data class would do) like so
@Serializable
class Model(
val name:String,
val language:String,
val platforms: List<String>
)
And with serialization. Once you've read your json file, you can just go ahead and get your value like.
val jsonString : String= readJsonFile("data.json");
val json = Json.parse(Model.serializer(),jsonString)