object to 字符串json
2024-10-15 16:20:10
package com.beijxing.TestMain; import com.beijxing.entity.Student;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName; /**
*
* @author 作者 : ywp
* @version 创建时间:2016年10月30日 下午9:21:33
*/
public class TestGson1 {
public static void main(String[] args) {
testGson();
}
public static void testGson(){
Student student = new Student();
student.setId(1);
student.setName("杨文培");
student.setSex("男");
//student.setAge(23);
student.setBirthday("1993-01-23");
Gson gson = new Gson();
System.out.println(gson.toJson(student));
}
}
最新文章
- mysql导入导出,及错误记录
- MongoDB 知识要点一览
- 【转】Android 当打开“开发者模式”中的“不保留活动”后,程序应当怎么保持正常运行
- Eclipse字符集设置方式
- 用TMS的控件就可以了,有bug叫他们改
- linux cpu亲和性设置
- 转:JavaScript定时机制、以及浏览器渲染机制 浅谈
- Hololens文件读写
- strictmode
- 【BZOJ4554】游戏(二分图匹配,网络流)
- 【移动开发】Service类onStartCommand()返回值和参数
- Feature Preprocessing on Kaggle
- Oracle 11g 测试ogg中断之后,重新同步操作
- ActiveMQ的作用总结(应用场景及优势)
- Redis详解(七)------ AOF 持久化
- 在windows环境下实现开机延迟启动tomcat
- LINQ学习之旅 C#3.0新特性(一)
- 在Ubuntu环境下安装eclipse
- jq的$(function(){})与window.onload的区别
- Java类中的各种成员的加载顺序