mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-17 11:15:54 +08:00
Replace use of gson in PluginManager (#1544)
This commit is contained in:
@ -2,6 +2,7 @@ package com.lagradost.cloudstream3.utils
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.mapper
|
||||
import java.io.Reader
|
||||
|
||||
object AppUtils {
|
||||
/** Any object as json string */
|
||||
@ -14,6 +15,10 @@ object AppUtils {
|
||||
return mapper.readValue(value)
|
||||
}
|
||||
|
||||
inline fun <reified T> parseJson(reader: Reader, valueType: Class<T>): T {
|
||||
return mapper.readValue(reader, valueType)
|
||||
}
|
||||
|
||||
inline fun <reified T> tryParseJson(value: String?): T? {
|
||||
return try {
|
||||
parseJson(value ?: return null)
|
||||
|
Reference in New Issue
Block a user