简体   繁体   中英

Kotlin-Android serialize json without using third party library

is there any solution other than Moshi, Gson, KotlinX-Serialization to serialize json in Android ? We should not add anything to build.gradle while using technology. We should not download a library from here.

Is there a method on Android just like Codable on iOS ? Also, I think how we should do this part is important since Converter will be passed when using it with Retrofit .

Does anyone have experience and advice on this subject?

You can use JSONObject for that.

val json = JSONObject("""{"some":"json"}""")

However, easiest is to use one of the third party frameworks you mentioned to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM