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));
}
}

object to 字符串json的更多相关文章

  1. JS json对象(Object)和字符串(String)互转方法

    [JS json对象(Object)和字符串(String)互转方法] 参考:https://blog.csdn.net/wenqianla2550/article/details/78232706 ...

  2. 字符串json转换为xml xml转换json

    原文:字符串json转换为xml xml转换json // To convert an XML node contained in string xml into a JSON string XmlD ...

  3. mongodb Decimal Spring data mongodb Decimal128 SpringMvc 序列化字符串 json converter

    Mongodb 3.4 就开始支持Decimal 类型,解决double的精度问题,但是不太好用,MapReduce的时候Array.sum 也不能计算 Decimal.比较坑,但是聚合可以用 Spr ...

  4. js数组,字符串,json互相转换函数有哪些

    js数组,字符串,json互相转换函数有哪些 一.总结 一句话总结: JSON.stringify(arr) JSON.parse(jsonString) str.split('') array.jo ...

  5. 将object格式转为json格式

    在页面内容显示时,有时需要用到json格式.但数据库内容的显示,需要将数据库中获取的格式转为json: using Newtonsoft.Json;public static string ToJso ...

  6. JAVA代码解析String字符串(json格式的)

    java解析String字符串(json格式) 需要jar包:json-lib-2.4-jdk15.jar 一. String str = "{\"name\":\&qu ...

  7. set object is not JSON serializable 解决方式

    python return json的时候报错: set object is not JSON serializable 解决方式,增加一个将set转为list的函数: def set_default ...

  8. 用第三方工具类,将JavaBean、List、Map<String,Object>转成JSON文本

    导入第三方jar包: >commons-beanutils-1.7.0.jar >commons-collections-3.1.jar >commons-lang-2.5.jar ...

  9. json 字符串 <----> json 对象

    一,字符串 -->JSON对象 1,转换函数 JSON.parse(json_str): 2,$.parseJSON(json_str):  用的是 jquery 的插件  所以需要引入 jq. ...

随机推荐

  1. GDB 调试 一些命令

    1. gdb查看指定地址的内存地址的值:examine 简写 x-----使用gdb> help x 来查看使用方式     x/ (n,f,u为可选参数)n: 需要显示的内存单元个数,也就是从 ...

  2. source tree 推送错误解决

    fatal: The remote end hung up unexpectedly 出现这个问题是因为文件过大 解决办法: 打开git bash 输入git config --global http ...

  3. 关于MariaDB5.5不是有效的Win32 应用程序

    操作系统:Windows XP sp3 数据库:MariaDB 5.5.49 问题原因: 使用文本编辑器打开mysqld.pdb文件. 在13行1012列,会发现如下信息: 这说明v5.5.49是使用 ...

  4. C语言实现GPT头和分区表的读取(gcc)

    #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h&g ...

  5. javascript 取整,取余数

    1.丢弃小数部分,保留整数部分 parseInt(5/2) 2 2.向上取整,有小数,则整数部分加1 Math.ceil(5/2) 3 3.四舍五入 Math.round(5/2) 3 4.向下取整 ...

  6. Eclipse使用tomcat的原理

    1. 当我们使用Eclipse将项目部署到Tomcat的时,我们发现,在Tomcat下的webapps目录下并没有我们创建好的项目,但是当通过Eclipse启动服务器后,项目却真的可以访问到,这是为什 ...

  7. Aptana插件安装方法

    本人用的是Zend Studio10.0,在开发项目过程中,发现该软件无法对css和js进行代码提示,这样用起来很不方便,然后在网上找了一下Aptana插件 进入Aptana官网:http://www ...

  8. PostgreSQL 在centos 7下的安装配置

    安装postgresql: sudo yum install postgresql-server 初始化数据库: sudo postgresql-setup initdb 启动数据库: sudo sy ...

  9. 用systemd脚本自动启动node js程序

    vi /usr/lib/systemd/system/pano.service [Unit] Description=pano - main site of site_name.com Documen ...

  10. 内容生成器:content、计数器、多列

    一,内容生成器:content 补充before和after伪类选择器: 1):将内容添加到某个选择器定义的单个或者多个元素的每一个实例之前或者之后 2)与before选择器配合使用(同理大家想下会不 ...