JSON在Android上 - 序列化 [英] JSON on Android - serialization
本文介绍了JSON在Android上 - 序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个序列化使用JSON的任何简单的例子为Android?
is there any simple example for Android of using JSON in a serialization?
感谢
推荐答案
我们使用 GSON 库的。序列化很简单,只要调用
We use the gson library for that. Serialization is as simple as calling
new Gson().toJson(obj)
和反序列化,
new Gson().fromJson(jsonStr, MyClass.class);
这篇关于JSON在Android上 - 序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文