Skip to content

Commit d80a1ba

Browse files
committed
fix: dotnet
1 parent 6c3fb00 commit d80a1ba

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

templates/kotlin/src/main/kotlin/io/appwrite/extensions/JsonExtensions.kt.twig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package {{ sdk.namespace | caseDot }}.extensions
22

33
import com.google.gson.Gson
4-
5-
val gson = Gson()
6-
4+
import com.google.gson.GsonBuilder
5+
import com.google.gson.reflect.TypeToken
6+
import {{ sdk.namespace | caseDot }}.json.PreciseNumberAdapter
7+
8+
val gson = GsonBuilder().registerTypeAdapter(
9+
object : TypeToken<Map<String, Any>>(){}.type,
10+
PreciseNumberAdapter()
11+
).create()
712
fun Any.toJson(): String =
813
gson.toJson(this)
914

0 commit comments

Comments
 (0)