Giter Site home page Giter Site logo

gson-demo's Introduction

gson-demo

gson对象

//通过构造函数来获取
Gson gson = new Gson();
//通过 GsonBuilder 来获取,可以进行多项特殊配置
Gson gson = new GsonBuilder().create();

Build

bazel build //:gson

Run

bazel-bin/gson

Result

hello!!! start gson!!
javaBean => json ===={
  "username": "张三",
  "password": "pass123",
  "money": 500
}

json => javaBean ====张三--pass123--500

list => json ====[
  {
    "username": "张三",
    "password": "pass123",
    "money": 500
  },
  {
    "username": "李四",
    "password": "pass111",
    "money": 3000
  }
]

json => list ====张三--pass123--500

json => list ====李四--pass111--3000

map => json ===={
  "p1": {
    "username": "张三",
    "password": "pass123",
    "money": 500
  },
  "p2": {
    "username": "李四",
    "password": "pass111",
    "money": 3000
  }
}

json => map ====张三--pass123--500

json => map ====李四--pass111--3000

gson-demo's People

Contributors

linvinglor avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.