Replace use of gson in PluginManager (#1544)

This commit is contained in:
Luna712
2025-02-11 06:42:48 -07:00
committed by GitHub
parent 82038643c8
commit 71b5c69426
2 changed files with 22 additions and 11 deletions

View File

@ -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)