android开发中使用Gson进行对象和Json之间的转换很方便

来源:互联网 发布:手机有声朗读软件 编辑:程序博客网 时间:2024/06/05 05:24

android开发中使用Gson进行对象和Json之间的转换很方便。

 

Gson gson = new Gson();String jsons = gson.toJson(eventLogList);

 

Result result = gson.fromJson(response, Result.class);
附言:
需要add 相关library
<dependency>    <!-- Using Gson for JSON marshaling -->    <groupId>com.google.code.gson</groupId>    <artifactId>gson</artifactId>    <version>2.2</version></dependency>

0 0
原创粉丝点击