[英]Kotlin-Android serialize json without using third party library
is there any solution other than Moshi, Gson, KotlinX-Serialization
to serialize
json in Android
?除了
Moshi, Gson, KotlinX-Serialization
之外还有其他解决方案可以在 Android 中serialize
Android
吗? We should not add anything to build.gradle while using technology. build.gradle在使用技术的时候不要加任何东西。 We should not download a library from here.
我们不应该从这里下载库。
Is there a method on Android
just like Codable
on iOS
? Android 上有
iOS
像Codable
上的Android
一样的方法? Also, I think how we should do this part is important since Converter
will be passed when using it with Retrofit
.另外,我认为我们应该如何做这部分很重要,因为当与
Retrofit
一起使用时, Converter
将被传递。
Does anyone have experience and advice on this subject?有没有人有这方面的经验和建议?
You can use JSONObject for that.您可以为此使用JSONObject 。
val json = JSONObject("""{"some":"json"}""")
However, easiest is to use one of the third party frameworks you mentioned to do this.但是,最简单的方法是使用您提到的第三方框架之一来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.