mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-06 17:18:11 +07:00
14 lines
376 B
Kotlin
14 lines
376 B
Kotlin
![]() |
package com.unciv
|
||
|
|
||
|
import com.badlogic.gdx.Gdx
|
||
|
import com.badlogic.gdx.utils.Json
|
||
|
|
||
|
class JsonParser {
|
||
|
|
||
|
private val json = Json().apply { ignoreUnknownFields = true }
|
||
|
|
||
|
fun <T> getFromJson(tClass: Class<T>, filePath: String): T {
|
||
|
val jsonText = Gdx.files.internal(filePath).readString(Charsets.UTF_8.name())
|
||
|
return json.fromJson(tClass, jsonText)
|
||
|
}
|
||
|
}
|