简体   繁体   English

不推荐使用GSON。 我们可以使用哪一个来对Java对象与JSON进行序列化和反序列化?

[英]GSON is deprecated. Which one we can use to serialize and deserialize Java objects to and from JSON?

Hi I want to store the Java Objects. 嗨,我想存储Java对象。

I have searched and found that the GSON library is doing the conversion of Java Object to Json String and vice versa. 我搜索发现GSON库正在将Java Object转换为Json String,反之亦然。 Then I can store the converted JSON String into the Shared Preferences. 然后,我可以将转换后的JSON字符串存储到共享首选项中。

But That GSON library is deprecated and there is no update after May 2013. 但是该GSON库已过时,并且在2013年5月之后没有更新。

Kindly provide me an alternate way to implement the same. 请为我提供另一种实现方法。

Thanks in advance. 提前致谢。

GSON is not deprecated and seems to be well supported ( commit history ). GSON没有被弃用,并且似乎得到了很好的支持( 提交历史记录 )。 If you are looking for an alternative Jackson is a popular one. 如果您正在寻找替代品, 杰克逊是一个受欢迎的人。

我认为这样做的原因是Google建议切换到Android Studio,如果您这样做,则无需下载jar, 只需在依赖项中简单地编译“ com.google.code.gson:gson:2.3.1”即可

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 ZA79956B0B2E7BDA297AZD5DAA572 将 3 个 json 对象反序列化为一个 java object - Deserialize 3 json objects to one java object with Gson javascript弃用了所需功能。 我们如何使用Internet Explorer驱动程序Selenium中启用的Java脚本 - Desired capabilities isjavascriptenabled deprecated. How can we use the java script enabled in Internet explorer driver selenium 使用gson在Java中反序列化json - Deserialize json in java with gson Android Java-从GSON序列化json日期 - Android Java - Serialize json date from GSON Jackson/Gson 将 JavaFX 属性序列化和反序列化为 json - Jackson/Gson serialize and deserialize JavaFX Properties to json 如何在不知道.class先验的情况下使用Gson在Java中反序列化和返回JSON对象? - How to deserialize and return objects from JSON in Java with Gson without knowing the .class a priori? Gson,无法序列化/反序列化类类型 - Gson, can't serialize/deserialize class type Gson序列化/反序列化Map到/从KeyValuePairs列表 - Gson serialize/deserialize Map to/from list of KeyValuePairs 如何使用Jackson将Java Enums序列化和反序列化为JSON对象 - How to serialize and deserialize Java Enums as JSON objects with Jackson 在Java中使用GSON序列化JSON文件 - Serialize JSON file with GSON in java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM