简体   繁体   English

Kotlin-Android序列化json不使用第三方库

[英]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 上有iOSCodable上的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.

相关问题 使用第三方Android库加载PPT文件 - Load PPT File using Third Party Android Library 不使用第三方库将xml字符串转换为JSON字符串 - Convert xml string to JSON string without using third party libs 如何在不使用Android中任何第3方库的情况下从基于json的api获取json数据? - How to get json the data from json based api without using any 3rd party library in Android? Kotlin-android:未解决的参考数据绑定 - Kotlin-android: unresolved reference databinding 如何在Eclipse中将第三方库集成到Android - How to integrate a third party library to Android in Eclipse 从 kotlin 调用的第三方 Java 库中的重载解析歧义 - Overload resolution ambiguity in third party java library called from kotlin 是否可以在没有任何第三方库的情况下使用@RequestBody将JSON转换为Java bean - Is it possible to covert JSON to java bean with @RequestBody without any third party library 如何在共享库中实现JSON功能而无需硬性绑定第三方依赖项 - How to implement JSON functionality in a shared library without hard-wiring third party dependencies 使用带有libgdx和GWT的第三方库 - Using a third-party library with libgdx and GWT 如何在不使用第三方库的情况下使用Java中另一个CSV文件中的值创建CSV文件 - How to create a CSV file using the values from another CSV file in Java without using third party library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM